Novelty scripting reference > Game variables

Game variables

Outside of scripting Novelty gives you a separate storage for game-specific variables. These can be accessed wither by actions or scripts and can be used to keep track of game events or player score. More importantly, these game variables are stored when the player saves the game.

Note: All game variables are of type Variant and can thus contain strings and numeric values alike.


Accessing game variables in scripts

Use the $-operator to access a game variable. If the variable doesn't exist it will be instantiated.

$Score = 9000;
Print($Score);

Internal variables

Game variables can also be closely associated with a specific object. These are called internal variables. They can be used to keep track of an object's state or other properties such as velocity in a physics simulation.

To access an internal variable, type the object handle then dot-dollar sign (.$) followed by the name of the variable:

Object@ obj = GetObject("Ball");
obj.$speed = 100;
Related articles:

Back to top