...
The following topics explain how to:
maxLevel Table of Contents
Scroll only | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||
For information on reserved words, also see Understand reserved words.
...
Scroll tablelayout | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
For example, to assign the type and value assigned to a variable named monster:
Code Block | ||
---|---|---|
| ||
float $monster = 3.8; |
The result of this assignment statement is a value of 3.8 being set for a variable named monster with a data type of float. This result can be used as a constant of the same type and value.
...
Variable data type | Definition | Examples |
---|---|---|
Boolean | Boolean flag. See Boolean. | true |
Float | Floating point number. See Float. | 265.8, -973.2 |
Int | Integer. See Int. | 0, 4, -7 |
String | Characters. See String. | "My mother has a car!" |
Vector | One-dimensional array of 3 floating points or integers (stored as floating points). See Vector. | <<1, 8.2, 7.6>> |
Variable names
...
The following examples show how to assign specific values to an integer, float, and vector variable respectively:
Code Block | ||
---|---|---|
| ||
int $frame = 1;
float $distance = 9.54322;
vector $position = <<1, 2.345, 6.789>>; |
The following example declares and assigns arrays:
Code Block | ||
---|---|---|
| ||
int $test[2];
$test[0] = 1;
$test[1] = 2; |
Scroll pagebreak |
---|
Use global variables
...
Here is an example of setting a global variable:
Code Block | ||
---|---|---|
| ||
// Sets a global variable. |
...
setGlobalVar $myVar value; |
...
// Gets a global variable. |
...
// Appropriate command must be used depending on variable type. |
...
getGlobalFloatVar; |
...
getGlobalIntVar; |
...
getGlobalStringVar; |
Note |
---|
Caution There is no way to delete a global variable, or to list global variables that have been set. |
...