Openbound - Game State
Game state in Openbound is basically attaching a value to a name. The value can be checked and changed at any time throughout the code, and persists throughout the entire game, regardless of rooms. They are commonly used instead of trigger guards, as they are much faster and much simpler to understand.
Table Of Contents
Setting state
Setting state is as simple as using the setGameState action.
<action command='setGameState'>
<args>poniesAreBeautiful,true</args>
</action>
The above code sets the name poniesAreBeautiful
to be true
.
Checking state
Using state is just as simple as setting it and can be done using the gameState trigger.
<trigger>
<args>gameState,poniesAreBeautiful=true</args>
<action command='setGameState'>
<args>poniesAreBeautiful,false</args>
</action>
</trigger>
This is a particularly useless trigger, which checks to see if poniesAreBeautiful
is true
and, if so, sets poniesAreBeautiful
to false
.