| S C R I P T   S P E C I F I C   C O M M A N D S |
- * text
- An '*' at the beginning of a line is a comment. The rest of the line is
ignored.
- global variable
- Global changes variable into a static variable.
- eval variable expression
- Eval evaluates expression and sets
variable to result. See section 7 for details on how
expression evaluation works.
- Example: eval foobar 15 - 5
sets the variable
foobar to the value 10
- break
- Terminate a series of commands associated with a particular case in a switch block. If break is not used before the next
case, the commands for the next case will be executed as
well. See switch and its example for a better understanding.
- case condition
- Defines an element within a switch block. See switch
below.
- default
- Used in a switch block; if none of the case conditions
have been met, the default set of commands will run. See the
switch example for a better understanding.
- done
- Terminate a switch or while block. See below.
- if (expression)
... elseif
(expression) ... else ... end
- An 'if' must occur before the other three. If expression
evaluates to true (see the Expressions
for more detail on expression evaluation), the statements between the if
statement and the next elseif, else, or end are executed. If it stopped at an
elseif or else, it scans for the next end, and continues execution at that
point. If the expression evaluated to false, it searches for the next elseif,
else, or end. If it finds an elseif, it checks that expression. If it is true,
it executes the statements between the elseif and the next elseif, else, or
end, and then finds the end of the block. If it is false, it continues
searching in the same pattern, until a true elseif is found, an else is found,
or an end is found.
- halt
- Halt ends the trigger execution.
- return value
- Return sets the return value of the trigger. Normally, a script will
return 1, unless another return value is specified with the return command.
Unlike most computer languages, the return command does not end the trigger's
execution. The value is returned after all the commands have been executed, or
a wait or halt command is called.
- set variable value
- Set sets variable to value, without
evaluating it.
- Example: set foobar 15 - 5
sets the variable foobar
to the string "15 - 5"
- switch expression
- This begins a conditional block that differs from if in the level
of complexity. An if block has one or two conditions which have
commands executed (one set of commands for "if this is true" and possibly
another set for "otherwise" (else)). When the possibilities for
blocks of commands exceed two cases, either additional if blocks are
needed, or a switch is needed. An example is shown here:
- * First pick a number between 1 and 3
- eval number %random.3%
-
- * Then do something based on the chosen number
- switch %number%
- case 3
- say the number is three
- break
- case 2
- say the number is two
- break
- default
- say the number must be 1, since it is constrained between
- 1 and 3, and it was not 3 or 2.
- break
- done
- unset variable
- Unset eliminates the specified variable if it exists.
- wait duration
wait until time
- A wait command causes the trigger to pause for a certain length of time.
If just a numerical argument is given, the pause will be for that many of
pulses (currently 0.1 seconds). If the number is followed by an 's', the pause
will be in real life seconds. If the number is followed by a 't', the pause
will be in tics (game hours). If wait until is used, the trigger is
paused until time. Time may be of the form
HH:MM or HHMM (e.g. 14:30 or 1430).
- while expression
- This starts a loop block. The block contains a series of commands which
will execute repeatedly until the expression is false. The
block is terminated with a done statement. The done
statement causes the expression used in the while line to be
re-evaluated and, if it is false, the loop breaks.
|
|