Variable declarations

Variable declarations allow you to specify a variable's networking priority and its initial value. They look like this:

declare SOME_VARIABLE
declare SOME_VARIABLE = SOME_NUMBER
declare SOME_VARIABLE with network priority SOME_PRIORITY
declare SOME_VARIABLE with network priority SOME_PRIORITY = SOME_NUMBER

When specifying the variable to declare, you are allowed to use an alias.

Only number and timer variables can be given initial values. These values can be any number except for another variable. If you do not specify an initial value (or if you don't declare the variable at all), then the initial value used is zero.

All variable types except for timers can have a networking priority set. The network priority values are:

low
Testing has established that low-priority variables can survive a host migration. If you don't specify a networking priority for a variable, this is used as the default.
high
Testing has established that high-priority variables can survive a host migration. If you wish to display a player variable in the UI, it must be high-priority.
local
Variables with this network priority aren't sent over the network at all. This is a good thing to use for temporary variables that are just used to do quick tasks, like computing a number to be stored elsewhere.

Declaring a variable multiple times generates a compiler warning if the declarations don't conflict with each other or contain redundant information (e.g. multiple initial values), or a compiler error otherwise.

Temporary variables

Temporary variables do not need to be declared, and cannot be given an initial value or a networking priority. Attempting to declare them is a warning, unless you also specify an initial value or networking priority, in which case it's an error.