VARIABLES: Difference between revisions
No edit summary |
No edit summary |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
Variables appear as a name surrounded by '%'s, such as | Variables appear as a name surrounded by '%'s, such as | ||
%actor% | |||
Before a command is processed, the line is scanned and any variables are | 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 it is there. If not, the global variables are checked. 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). | ||
replaced. First the list of local variables are checked to see if it is | |||
there. If not, the global variables are checked. 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). | |||
Two '%'s in a row will be interpreted as a single '%'. | Two '%'s in a row will be interpreted as a single '%'. | ||
There are two types of variables, local and global. All local variables | There are two types of variables, local and global. All local variables are deleted when a script finishes executing, and can only be used by the script. Global variables remain until removed with unset, or the script is removed. | ||
are deleted when a script finishes executing, and can only be used by the | |||
script. Global variables remain until removed with unset, or the script is | |||
removed. | |||
A field of a variable can also retrieved, based on their type. To get a | 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 for each type of game object are listed below. | ||
field, a notation of %variable.field% is used. The valid fields for each | |||
type of game object are listed below. | |||
Variables are case insensitive. | Variables are case insensitive. | ||
See also: [[CHARACTER VARIABLES]], [[ROOM VARIABLES]], [[OBJECT VARIABLES]], | See also: [[CHARACTER VARIABLES]], [[ROOM VARIABLES]], [[OBJECT VARIABLES]], [[SPECIAL VARIABLES]] | ||
[[CATEGORY:Scripts]] | [[CATEGORY:Scripts]] | ||
Latest revision as of 02:11, 7 December 2009
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 it is there. If not, the global variables are checked. 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).
Two '%'s in a row will be interpreted as a single '%'.
There are two types of variables, local and global. All local variables are deleted when a script finishes executing, and can only be used by the script. Global variables remain until removed with unset, or the script is removed.
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 for each type of game object are listed below.
Variables are case insensitive.
See also: CHARACTER VARIABLES, ROOM VARIABLES, OBJECT VARIABLES, SPECIAL VARIABLES