3. Program Execution Commands
These are some of the most important commands.
set flagname; sets a flag to true-This sets a flag in the player's flag list with the value of what you put for "flagname".
if (playertouchsme){
  set iwastouched;
}
This would put "iwastouched" in the player's flag list.
unset flagname; sets a flag to false - Removes the flag from the player's flag list (assuming it's in his list).
if (playertouchsme){
  unset iwastouched;
}
This would remove "iwastouched" from the player's flag list.
break; ends a loop and continues with the script that follows to the loop - causes a loop to end, and doesn't execute what follows the break command.
while (myvar<5) {
    myvar++;
    if (myvar=5) {
      break;
    }
    var2++;
}
While myvar is less than 5, it will add 1 to myvar, and if myvar equals 5 after that 1 is added to it, then the loop will break and the rest of the script executes, otherwise var2 gets 1 added to it.
continue; jumps to the beginning of the loop (next loop round) - restarts the loop from the beginning
while (myvar<5) {
  myvar++;
  if (myvar<4) {
    continue;
  }
  var2++;
}
While myvar is less than 5, it will add 1 to myvar, and if it is less than 4, the loop will go back to the beginning and add 1 to myvar again, once it is no longer less than 4, then it will also add 1 to var2; until myvar is equal to 5 of course.
function functionname(){operations} Defines a function. - Creates a function with the specified name and operations.
function AddVars() {
  total=var1+var+var3;
}
This defines the function 'AddVars'.  When 'AddVars' is called, it will add the values of var1, var2, and var3 and store that value in the variable 'total'.
functionname (); Calls an already defined function.
if (gotvalues){
  AddVars();
}
When the flag 'gotvalues' is set, the function 'AddVars' will be called.
return; ends the function immediatelly and returns to the function caller - Stops executing from the function and goes back to the rest of the script.
function Rup(){
  if (playerrupees<100) return;
  message A lot of rupees!;
  sleep 3;
}
if (playertouchsme){
  Rup();
  message Bye!;
}
If the NPC is touched, 'Rup' will be called.  In the function 'Rup', when it is called, if the player has more than 100 rupees, the NPC will say 'A lot of rupees!' then sleep for 3 seconds, then continue with the rest of the script.  If they have less than 100 however, then the NPC will not say 'A lot of rupees!' and will just go back to the line after the function was called (therefore saying 'Bye!').
sleep seconds; pauses the script execution for the specified time - This causes the NPC to sleep for the amount of time indicated.  No other actions will be executed will the NPC is sleeping.
if (playertouchsme){
  sleep 1;
  putexplosion 1,x,y;
}
This would put the NPC to sleep for 1 second, then put an explosion at it's x,y.
setarray var,size; initializes var as an array of  the specified size - This would set the array with the name you specify for "var" and with a size you specified for "size".  For information on this read section 2H.
if (created){
  setarray myarray,5;
}
This would set the array "myarray" with a size of 5 when the NPC is created.
setstring varname,value; creates a string variable ‘varname’ with the given value - This sets a string with the name you put for "varname" with the value specified for "value". This information is stored in the player's flag list, and the value can be either text or numerical.
if (playerchats){
  setstring playersaid,#c;
}
This would set the string "playersaid" with the value of whatever the player said to cause the string to be set.  For information on messages strings (such as #c) read sections 2F, and 13.
timereverywhere; allows timeouts on this machine even if the player didn’t entered the level first - This stops some glitches when timeouts are used in online mode.  It makes it so the NPC goes by the same timeout for each person on the level, not just the first person that entered.
if (created){
  timereverywhere;
}
Makes the timeouts done by the NPC the same for all people on a level.