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

m
formatting fix
imported>8asrun6aer
(expanding on comments section)
imported>8asrun6aer
m (formatting fix)
Line 73: Line 73:


===Code Comments===
===Code Comments===
Comments can be placed in-code with the semicolon character - ; - Whatever you type after the semicolon on the same line will be ignored when the script compiles.  If you want more than one line of comment, you must have one semicolon for each line.
Comments can be placed anywhere in-code with the semicolon character - '''';'''' - Whatever you type ''after'' the semicolon on the same line will be ignored when the script compiles.  If you want more than one line of comment, you must have one semicolon for each line.


You use comments inside your scripts to generally explain what you are trying to accomplish in your code, which can help you and others understand what's going on inside the script quickly at a later date.  Comments can also serve as a debugging technique by commenting out lines of code one-by-one to pinpoint the source of some odd or unintended effect in-game.   
You use comments inside your scripts to generally explain what you are trying to accomplish in your code, which can help you and others understand what's going on inside the script quickly at a later date.  Comments can also serve as a debugging technique by commenting out lines of code one-by-one to pinpoint the source of some odd or unintended effect in-game.   


Note: Because everything appearing on a line after the semicolon is not treated as compilable code, one issue you might face is that you cannot simply put semicolons in strings.  If you need to have a semicolon as part of a string - for example a message in-game - you could instead use the [[OBSE]] "%a" Format Specifier and passing in ASCII character code 59, or use the [[AsciiToChar]] OBSE function.
Note: Because everything appearing on a line after the semicolon is not treated as compilable code, one issue you might face is that you cannot simply put semicolons in strings.  If you need to have a semicolon as part of a string - for example a message in-game - you could instead use the [[OBSE]] "%a" Format Specifier for functions that support this and passing in ASCII character code 59, or use the [[AsciiToChar]] OBSE function.


===Writing text and obtaining decisions from the player===
===Writing text and obtaining decisions from the player===
Anonymous user