Difference between revisions of "Scripting Tutorial: My Second Script"

→‎The scripting window: changing the notes about external editors to something more appropriate
imported>DragoonWraith
(nominating this)
imported>DragoonWraith
(→‎The scripting window: changing the notes about external editors to something more appropriate)
Line 35: Line 35:
[[Image:1_script_window.JPG|thumb|left|The scripting window]]Let's have a look at the buttons in the taskbar, from left to right: ''Open'' lets you select a script to edit. ''Save'' error checks the current script and either compiles it or gives out error messages. Note, however, that the plugin and thus the script is not really saved to disk at this time. When programming large scripts you should frequently use the save command in the main TESCS window after you have saved the script here, just in case the TESCS crashes. Note also that if you edit the script and suddenly hit "save plugin" to backup in the middle of the work, your updated script will NOT be saved with it. You must save it manually first. Also, if you simply close the script window, it doesn’t mean that script will be saved. You must take care of it yourself.  
[[Image:1_script_window.JPG|thumb|left|The scripting window]]Let's have a look at the buttons in the taskbar, from left to right: ''Open'' lets you select a script to edit. ''Save'' error checks the current script and either compiles it or gives out error messages. Note, however, that the plugin and thus the script is not really saved to disk at this time. When programming large scripts you should frequently use the save command in the main TESCS window after you have saved the script here, just in case the TESCS crashes. Note also that if you edit the script and suddenly hit "save plugin" to backup in the middle of the work, your updated script will NOT be saved with it. You must save it manually first. Also, if you simply close the script window, it doesn’t mean that script will be saved. You must take care of it yourself.  


'''Elster's Tip:''' I find, if I write my scripts in Notepad (or a similar plaintext editor - Word is a bad choice because of the margins), I can simply save it straight to my hard drive, and then copy and paste it into TES script editor when I'm finished with it.
Side Note: You can also write your code in external editors and paste it into the CS. This can make it easier to keep scripts saved, and can be more convenient, since you don't have to load the CS and your mod. Options include [[S!lk]], emacs, and [[Notepad++ Script Definitions|Notepad++]], all of which have syntax highlighting plugins for Oblivion script (only Notepad++ has up-to-date OBSE functions included, however).
'''Added by Grosie:''' The best thing is probably 'Notepad 2' as it automatically keeps the tabbed in formatting that is used for a clearer script. I also use Notepad 2 for a myriad of other things due to it's syntax hylighting and simplicity.


''Forward'' and ''Backward'' arrows jump to the next or previous script, respectively (in alphabetical order). If you give your scripts a common tag, that will make it easier to jump between the different scripts of your project. For example, my pseudonym is Grundulum, and he starts every script name with "GR_ShortReferencetoProject_", with that second part being a two or three letter reference to the current mod; this keeps all of the scripts you're working on neatly together. ''Compile all'' recompiles all scripts (what's this good for? Ghanburighan didn't know, and neither do I (Grosie: see [[Edit Scripts]])). It also adds every script in Oblivion to your mod, so you'll wind up with a 2MB esp file that conflicts with just about everything. Use this button sparingly, if ever.  Finally, the ''Delete'' button deletes a script, and the last ''Arrow down'' button closes the script window.
''Forward'' and ''Backward'' arrows jump to the next or previous script, respectively (in alphabetical order). If you give your scripts a common tag, that will make it easier to jump between the different scripts of your project. For example, my pseudonym is Grundulum, and he starts every script name with "GR_ShortReferencetoProject_", with that second part being a two or three letter reference to the current mod; this keeps all of the scripts you're working on neatly together. ''Compile all'' recompiles all scripts (what's this good for? Ghanburighan didn't know, and neither do I (Grosie: see [[Edit Scripts]])). It also adds every script in Oblivion to your mod, so you'll wind up with a 2MB esp file that conflicts with just about everything. Use this button sparingly, if ever.  Finally, the ''Delete'' button deletes a script, and the last ''Arrow down'' button closes the script window.