A constant is an identifier with a predefined value. Contrary to a variable the value of the constant can not be changed in run-time. During compilation the constant name is replaced with the value associated with it. The constant values can be numeric (numerals) and string (string literals), and contain an expression.
To define a new constant use the
<constant name> = <constant value>
A constant name is any allowed identifier (a combination of letters, numbers and
_). There are names reserved by the compiler that can not be used, such as
And, etc (see
A constant value might be a number (also a model identifier or a label); a string literal; a variable (also a class property); another constant.
constMoneyRequired = 30PlayerMoney = $PLAYER_CHAR.MoneyendifPlayerMoney > MoneyRequiredthenPlayerMoney += -1end
During compilation the constant
MoneyRequired gets replaced with the number
Edit modes can load constants from an external file by using the
<constants> parameter in the
A list of the currently defined constants is displayed after pressing
You can use constants anywhere except the case:
constVarName = $VarIndexName = 25endVarName[IndexName] = 0
To compile such expression, you must write the opcode, for example:
0004: VarName[IndexName] = 0
Also there are some limitations with using an expression as the constant value.