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

section request
imported>GhanBuriGhan
imported>GuidoBot
(section request)
Line 29: Line 29:
And great job converting it for Oblivion, I actually learned a couple of things myself :)  
And great job converting it for Oblivion, I actually learned a couple of things myself :)  
--[[User:GhanBuriGhan|GhanBuriGhan]] 12:56, 28 July 2006 (EDT)
--[[User:GhanBuriGhan|GhanBuriGhan]] 12:56, 28 July 2006 (EDT)
== Section request ==
Firstly, nice job! I wondered if you wouldn't mind adding a section on the script compiler (interpretor) quirks and general things to use or watch out for? To get you started, and by way of example:
#Uses of space, comma and parenthesis. Arguments to commands have to be separated by spaces or/and commas. Commas are treated as spaces and are not necessary. You cannot use spaces in math expressions without parenthesis. For example, '''set x to a + b''' is not compiled correctly but '''set x to a+b''' and '''set x to (a + b)''' are. Note: '''set x to a-b''' is not compiled but '''set x to (a)-b''' is fine. (Compiler glitch.) Spaces around logical evaluators are optional, i.e. '''a==1''' and '''a == 1''' are equivalent(?).
#Use of ';' for comments and debugging.
#Use of '''Message''' for debugging.
#Matching '''Begin''' with '''End''' in blocks, and not confusing with '''endif'''.
Compiler glitches to watch for - i.e. things that the compiler doesn't pick up that will break your code!
#Extra arguments to functions: example '''if a == 3 garbage''' - the extra '''garbage''' is/maybe ignorred. Similarly when functions are used as arguments, e.g. '''set a to b*3 GetContainer garbage'''.
#Mismatched '''if/else/elseif/endif''' statements. e.g. '''if...endif...endif'''. Some of these types of error will get picked up but some wont.
#Buggy lazy logic. e.g. for '''if x == 4 && y == IsInCombat'''. Sometimes a set of conditions on one line do not get compiled correctly. Often best to use nested '''if''' blocks instead. Very hard to know when this has or is going to happen.
If this stuff has been covered already then feel free to remove or move this from the discussion. Instead please add a link or links to the relevent articles in your article.
Anonymous user