Local Variables
Last updated
Was this helpful?
Last updated
Was this helpful?
Local Variables are variables which are local to the specific guest. Local Variables can be set using the Flow Controller, and can be used in other Flows to control behavior.
To set a local variable, use the Set Local Variable
listener.
The listener takes a Key
and a Value
. The key is the name of the variable, and the value is the new value you want to set that variable to.
To read a local variable, and use it in a Flow, use the Read Local Variable
value Node.
The value node takes a Key
. The key is the name of the variable you want to get the current value of. The Value
output will send the current value of the Local Variable to the next node in the Flow.
Say we want to keep track of whether the guest has a chat panel open. We can use a Local Variable to keep track of the local state of that panel.
For a detailed look at Flows, check out the Flows Fundamentals page.
This is just an example.
To create this yourself, you'll need to make the animation states on a Stacked module.
Here, we build a Flow from the Button:on-click
Broadcaster. When this button is clicked, we pressurize an Equals
Node.
We pass the current value of chatPanelOpen
into this Equals, and check if it's set to TRUE
.
If the Local Variable is TRUE
(meaning the panel is currently open), we set the animation state of the panel to closed
, and set the Local Variable to FALSE
.
If the Local Variable is not TRUE
(meaning the panel is currently closed), we set the animation state of the panel to open
, and set the Local Variable to TRUE
.