TRIGEDIT-VARIABLES VARIABLES TRIG-VARS TRIG-VARIABLES VARS
TRIGEDIT-VARIABLES VARIABLES TRIG-VARS TRIG-VARIABLES VARS
Variables appear as a name surrounded by '%'s, such as %actor%
Before a command is processed, the line is scanned and any variables are
replaced. First the list of local variables are checked to see if the variable
is there. If not, the global variables are checked. A proper global match must
have a zero context or the current context of the script. (When a script starts
running, its context is 0. The script context command may be used to change
context.) If a match is still not found, a list of 'built in' variables (ones
not declared by the script) are checked. If no match is found, the variable is
replaced with an empty string (the variable is removed from the line, and
nothing added in its place).
There are two types of variables, local and global. All local variables are
deleted when a trigger finishes executing, and can only be used by the trigger.
Global variables remain until removed with unset, or the script is removed.
Global variables also have a context associated with them. By default, the
context is 0. Any global being referenced with a context of zero will be seen.
Through the 'context <value>' command, a script may set its context to any
integer; Globals created are always assigned the current script context. When a
global is referenced, if it's context is not 0 or the current context of the
script, it will not be seen. This technique allows, among other things, arrays
of globals to be created by using a series of contexts as indexes. Also, it
allows globals to be associated with a specific character, room, or object in
the game, by using the id of the target as the context.
Variable Fields
A field of a variable can also retrieved, based on their type. To get a field,
a notation of %variable.field% is used. The valid fields are listed in the help
files below.
{cRCHAR-VAR{c0 - Variables for characters. {cRTSTAT 27{c0
{cROBJ-VAR{c0 - Variables for objects. {cRTSTAT 28{c0
{cRROOM-VAR{c0 - Variables for rooms. {cRTSTAT 29{c0
{cRTEXT-VAR{c0 - Variables for text. {cRTSTAT 30{c0
{cRSPEC-VAR{c0 - Variables for special stuff. {cRTSTAT 31{c0
See Also: GLOBAL