Variables

 
Sometime it could be necessary to store the result of an action for using it as input to other actions.
This lets you avoiding to create too many states that make Finite State Machine graph growing too much and being too complex
Variables are designed for this purpose, they are a block of memory in which it is store a value basing on its type.
 
In GameMachine variables can be of following types:
  • string
  • float
  • int
  • vec3
  • bool
 

The type of the variable and the input/output of the action must match. So the system will automatically let you to choose only among allowed variables for a given input/output

 
If the parameter of an action has a V symbol at its right it means that the parameter can accept variables as input.
In this case you have to click on the V symbol to enable/disable variable input:
4.1.4. Variables
1

Variable input disabled

1. Variable input disabled
In this case you have to insert the value of the input manually, in a way that depends on the type of the parameter
 
4.1.4. Variables
1

Variable input enabled

1. Variable input enabled
In this case you can choose among the variables in the combobox list
2

Allowed variables list

2. Allowed variables list
You can choose the variable to assign to the parameter among the variables in the combobox dropdown list
 

Variables can be:
  • Local: they can be used only inside the same GameMachine (in other words inside the same object)
  • Global: they can be shared among all GameMachines of the game (for example if you want to store the score of the player)
  • Parameter: they are used as parameter to the GameMachine (in this case you will see them into the class properties of the owner object)
 
To add a new variable to a GameMachine see Vars tab.