Scripting for beginners

Revision as of 09:56, 15 April 2010 by imported>Darkness X
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This is a simple tutorial on scripting, There are alot of others out there, but this one will show you the very basics. This tutorial will give detailed instructions n the scripts, and what the coding means in each script.


Tools used in this tutorial

Required


What We Will Accomplish:Edit

Learning about basic scripting.

A first scriptEdit

This is a basic script that will show you the ropes of basic types of scripting, it will come in handy alot!

starting offEdit

Load up your Oblivion master file (.esm) You can load any other data file (.esp) if you want, but o avoid conflicts, do NOT set a file at the active file.

Now, extend your branch (List) to the following:

Items > Weapons > Iron

And click on any random item, however check that it's not scripted yet.

Beginning the scriptEdit

So, you have opened the weapons menu. You should notice that the script area has an elipse (...) button next to it. Click on that. Now, click file > new. Then, type the following:

scriptname PickupScript
;this is the name of the script

Begin OnAdd
;Makes the script start when it's added to your inventory.
Messagebox 'You've just picked up a weapon.'
;This makes a box come up saying 'You've just picked up a weapon' when you pick it up.
Message 'Weapon added.'
;this makes a message come up in the top left corner notifying you that you've successfully added it.
End
;ends the script

There, finished! The semicolon (;) means it's a comment, it is not required as it does not do anything, but may help you know what your doing later on in more complicated scripts.

almost there!Edit

Now, with the script box still up, click save (the disc button with white, not red, otherwise you'll recompile all the scrips; a bad thing!)

now you can exit the script menu. exit the weapon menu and reload it. open the list of scripts and choose PickupScript from the dropdown menu. Change the ID to ScriptTutorial weapon or whatever you want, and click ok. Click yes to the 'create a new form' messages. Done!

See Also: Scripting Tutorial: My First Spell
Scripting Tutorial: My First Creature Script
Scripting Tutorial: Summoned Creatures -- Note this one is alot more complicated
Scripting Tutorial: Spell Tome
Scripting Tutorial: Creating a Simple Timer