🟥 Condition
The block Condition allows you to check whether or not a condition is fulfilled.
This condition is bound to give a true or false result.
To determine it, click and hold the point "condition" and drag it with your mouse and release the click:
Perhaps related to this point condition:
A boolean variable (true/false)
One or more numeric variables
One or more text variables
Let's go into detail:
A boolean variable you have already created in your project.
In this case the value of the variable necessarily true or false, so you can link the variable directly to the Condition block. The Condition block will then redirect the History thread to True if the value of the boolean variable is true at that moment for the user, False otherwise.
More information on Boolean variables in ☑️ Setting up simple conditions
Note: To connect the reserved value of a boolean variable to the Condition bloc, connect first a Not block, then the boolean variable to the Not block, like this.
One or more numeric variables via an expression block.
Some examples:
If a numerical variable is less than a number,
If a numeric variable is greater than or equal to a number,
If a numeric variable is equal to another variable,
Double-click on the Expression block, and enter in the expression field of the block edit window the mathematical expression with unknowns to designate your variables.
Ex: Relationship with Julie is equal to 5/10 translates to: X == 5
More information in ➗ Mathematical operations
We notice that X is recognized as an unknown and appears both in the editing window of the Expression block and in its display on the graph.
Right-click on the ... in the variable Number tab and click on select a variable.
The variable menu opens. Simply select the desired numerical variable. In this example let's take the variable Score.
It appears in the editing window of the Expression block. It is connected to the unknown X.
When the Storyline passes through the Condition block, it will be redirected to True if the Score variable is equal to 5, to False otherwise.
One or more text variables via an expression block.
Some examples:
If a text variable is equal to a string of characters (the keyboard keys entered correspond to a single key combination, a word or a number),
If a text variable is equal to another text variable (for example previously entered by a user)
If a text variable is equal to a string of characters in a series (if the keyboard keys entered correspond to one or more key combinations, in the case of several options for recognizing an intention via several versions of a word or phrase)
Ex.: We want to customize the rest of the experience if the user's name is 'Julie'. In this case we write an expression: Y == 'Julie'.
It is important to put the word Julie between apostrophes to indicate that it is not an unknown, but a combination of keys, and therefore a textual value to which you want to compare the unknown.
You notice that Y is recognized by the Expression block edit window and its display in the graph.
Select the Text tab to designate Y and click on the ... on the right.
Click Select Variable.
Let's choose the text variable username for example, whose initial value is not defined, by clicking Select.
The username value is now associated with Y.
So, if the variable username is equal to Julie at the moment the Story Feed reaches the Condition block, then it will be redirected to True, otherwise False.
To learn more about text variables, go to 🔑 Enter a keyword or code (advanced)
This condition is bound to give a true or false result.
To determine it, click and hold the point "condition" and drag it with your mouse and release the click:
Perhaps related to this point condition:
A boolean variable (true/false)
One or more numeric variables
One or more text variables
Let's go into detail:
A boolean variable you have already created in your project.
In this case the value of the variable necessarily true or false, so you can link the variable directly to the Condition block. The Condition block will then redirect the History thread to True if the value of the boolean variable is true at that moment for the user, False otherwise.
More information on Boolean variables in ☑️ Setting up simple conditions
Note: To connect the reserved value of a boolean variable to the Condition bloc, connect first a Not block, then the boolean variable to the Not block, like this.
One or more numeric variables via an expression block.
Some examples:
If a numerical variable is less than a number,
If a numeric variable is greater than or equal to a number,
If a numeric variable is equal to another variable,
Double-click on the Expression block, and enter in the expression field of the block edit window the mathematical expression with unknowns to designate your variables.
Ex: Relationship with Julie is equal to 5/10 translates to: X == 5
More information in ➗ Mathematical operations
We notice that X is recognized as an unknown and appears both in the editing window of the Expression block and in its display on the graph.
Right-click on the ... in the variable Number tab and click on select a variable.
The variable menu opens. Simply select the desired numerical variable. In this example let's take the variable Score.
It appears in the editing window of the Expression block. It is connected to the unknown X.
When the Storyline passes through the Condition block, it will be redirected to True if the Score variable is equal to 5, to False otherwise.
One or more text variables via an expression block.
Some examples:
If a text variable is equal to a string of characters (the keyboard keys entered correspond to a single key combination, a word or a number),
If a text variable is equal to another text variable (for example previously entered by a user)
If a text variable is equal to a string of characters in a series (if the keyboard keys entered correspond to one or more key combinations, in the case of several options for recognizing an intention via several versions of a word or phrase)
Ex.: We want to customize the rest of the experience if the user's name is 'Julie'. In this case we write an expression: Y == 'Julie'.
It is important to put the word Julie between apostrophes to indicate that it is not an unknown, but a combination of keys, and therefore a textual value to which you want to compare the unknown.
You notice that Y is recognized by the Expression block edit window and its display in the graph.
Select the Text tab to designate Y and click on the ... on the right.
Click Select Variable.
Let's choose the text variable username for example, whose initial value is not defined, by clicking Select.
The username value is now associated with Y.
So, if the variable username is equal to Julie at the moment the Story Feed reaches the Condition block, then it will be redirected to True, otherwise False.
To learn more about text variables, go to 🔑 Enter a keyword or code (advanced)
Updated on: 29/03/2021
Thank you!