5.7 Variables

Variable Integers can be used as a trigger when nothing else will fit the situation. They are usually used when an event on one team causes an event on another team, and none of the usual condition types are viable. A variable is a numeric tag that can be set to any number. In DR2 we typically just used the values 0 and 1, like a switch. All the following commands are executed from an Action scope.
The command to create a variable is:


CreateVarInteger("@.[var name]", 0);


Give the variable a name. The number is the value that the variable will start as. This command is put in the Action scope and is usually called in the starting objectives for a team (created at beginning of mission).

To change the value of a var, the following command is used. The number is the new value to assign the var. This line goes in an Action scope.


Op("@.[var name]", "=", 1);


Finally, use a Condition statement to test when the var has been changed.
Condition("If", "@.[var name]", "==", 1);


The above condition would become true when the specified var's value has changed to 1.

For more on variables and how they are used, see Section 7.1.