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

imported>Grundulum
imported>Illincrux
Line 61: Line 61:
   ; Here we will enter what happens when the chest is opened.
   ; Here we will enter what happens when the chest is opened.
End</pre>
End</pre>
'''Click ''Save'' again now.''' The script still doesn't do anything, but at least now we have defined under what conditions it will run.  There are a couple of things to note here.  First, we have ended the current block before beginning a new one—not so important when there's only one block, but as this script gets more complicated we'll need multiple blocks in a single script.  In somewhat more technical terms, '''Begin/End blocks do not nest.'''  The other thing to notice is the semicolon ";" on line 4.  A semicolon marks the rest of the line as ''comment''.  Whatever you type after the semicolon ''on that one 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.
'''Click ''Save'' again now.''' The script still doesn't do anything, but at least now we have defined under what conditions it will run.  There are a couple of things to note here.  First, we have ended the current block before beginning a new one—not so important when there's only one block, but as this script gets more complicated we'll need multiple blocks in a single script.  In somewhat more technical terms, '''Begin/End blocks do not nest.'''  The other thing to notice is the semicolon ";" on line 4.  A semicolon marks the rest of the line as ''comment''.  Whatever you type after the semicolon ''on that one line'' will be ignored when the script compiles. You use comments to explain your code, which can help you and others understand what's going on inside the script quickly at a later date.  If you want more than one line of comment, you must have one semicolon for each line.


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