Logic is used to track, trigger and monitor different events via variables. Variables are data values that can change during the RichCast Title, such as a score value.
To create a new variable, open a Logic Tile and click the add variable button at the bottom, then User, and the plus at the bottom. Type in your variable name and set it to be either a Number, Boolean (True or False) or Visual Node Layer Visibility (VNLV).
Creators can use their variable by choosing “Set” in a Logic Tile. Variables can be set at any time. For example, if a Creator is creating a quiz, and the player gets a question right, they will want to set their score variable to increase by 1. Alternatively, if the player has visited a location, Creators may want to set VisitedLocation to be true.
Once set, ‘If’ statements can be used to change the players' experience. For example, if the score is 1, the player may be taken to a Speak Tile where they're told to go back and study, whereas if they got 10 out of 10, they may be directed to a Speak Tile where they're complimented for their performance.
Else can also be selected by clicking on If, and clicking on where it says If. They work in the same way as If. Every If should have an Else to make sure the flow continues. If a Boolean is true, go to this tile. Else, go to this other tile. Both should be connected to the previous tile, not to each other.
Ticking the "Watch" option will allow Creators to track the Variable on the console in Test Mode.
Shuffle and Random can be selected with a number variable by clicking the "Number" dropdown in a Set command. Both shuffle and random will set a variable to be a number between two specified numbers. Random will always pick a number at random from those parameters. Shuffle will exhaust all options first before repeating a number.
Creators can create a wait by selecting If, and then Wait. The wait is in seconds, depending on what the Creator types in the time box.
System variables are pre-programmed variables you can set a custom variable to be. We will be adding more in the future.
Creators may wish to make a timer. This can be done in the following way:
- Make two new number Variables: StartTimer and Timer. Set them to 0.
- Set StartTimer to equal Session Time.
- Set Timer to Equal Session Timer, and then change "End" to "Continue", and Decrease by StartTimer.
- Have an If and Else Statement. If Timer is greater than X (X being the seconds you want your timer to be), continue. Else, loop back to the previous Set Logic Tile.
This may require a bit of fiddling to get right. Please look at Project Logic in the app, where this technique is shown with videos on how to set it up.
For a video tutorial on Logic, click here.
Using Logic to turn on and off Layers within a visual tile.
You may wish to turn certain Visual layers on/off at different points in your experience. You can do this using the Visual Node Layer Visibility (VNLV). To do this, create a new variable and change the Type to be VNLV. Then Creators can set this variable, select the visual Tile and the layer, and then turn it on or off.
First set up a Visual tile with the desired layers ensuring the tile and layers are named well and uniquely.
Then in a Logic tile, you can set the 'Layer visibility choosing the correct tile by name, then it will display the layers within that tile and you can choose what to turn on and off with the Hide and Show option.
Tips and Advice
Make sure to not have two variables with the same/similar names. This could cause faulty logic.
We recommend creating your variables in CamelText.
If you have a fallback/common Speak Tile (e.g “How may I help you”), consider writing three or four variants and use the Shuffle feature in a Logic Tile. This will go through all possible combinations before repeating any.
We recommend having a Google Docs/ Word document that you can put Variable names in a table, alongside where the variable is used. This can help find faulty tiles quickly when debugging.
Make sure not to have multiple IF statements trigger at the same time, as this could cause issues with your Title continuing down multiple flows at once.