Conditional
Conditional checks a variable. Then it runs different actions for different values. For example, if the reader has the key, the visual novel goes to one section. If not, it goes to another section.
The reader does not see a choice. To let the reader choose, use Choices.
Before you start
A Conditional needs a variable to check. Create the variable first on the Variables page. This page uses this example:
- The variable is Has Key. Its Type is Boolean, so it is either True or False. Its Default is False.
- The Prologue scene has two more sections: Open Door and Locked Door. To add a section, see Scene Editor.
To change the variable during the visual novel, add Update Variable to an earlier line.
Add a Conditional
-
In the scene editor, tap an empty line, such as line 2 of Section 1. The visual novel does not stop on this line, so its text would not show.
-
Open the Actions menu.
- Phone or tablet: Tap the + button in the bottom bar.
- Desktop: Click the + button under Presentation state.
-
Under Logic, tap Conditional. You may need to scroll down first.
The Conditional box opens.
Parts of the Conditional box
This is the box after you finish the example on this page.
- Branches: the list of branches. Each branch checks the variable and has its own actions.
- + Add Branch: adds a new branch.
- Default branch: runs when no branch above it matches.
- Three dots button (the button with three dots): opens the menu of the branch.
- Submit: saves the Conditional on the line.
Add a branch
A branch has a condition and actions. When the condition is true, the branch runs its actions.
-
Tap + Add Branch. The Branch box opens.
-
Under Variable, choose Has Key. Operator shows Equals.
-
Under Value, choose True.
-
Under Actions, tap +.
A list of actions opens.
-
Tap Section Transition.
-
Under Scene, choose Prologue.
-
Under Section, choose Open Door.
-
Tap Submit. The action shows under Actions as Prologue - Open Door.
-
Tap Save Branch.
The branch shows in the Branches list as Has Key equals True.
Add the default branch
The default branch has no condition. It runs when no branch above it matches. A Conditional can have one default branch. It always stays at the bottom.
-
Under Default branch, tap + Add Default Branch.
-
Under Actions, add a Section Transition to Locked Door. Use steps 4 to 8 of "Add a branch".
-
Tap Save Default Branch.
The Default branch shows 1 action.
Save the Conditional
At the bottom of the Conditional box, tap Submit. The box closes. A gear icon shows at the right end of the line.
How branches are checked
When the visual novel reaches the line, the Conditional checks the branches from top to bottom.
- It runs the first branch that matches. It skips the branches below it.
- If no branch matches, it runs the Default branch.
- If nothing matches and there is no default branch, nothing runs. The visual novel goes on to the next line.
In the example, Has Key starts as False. So the default branch runs, and the visual novel goes to Locked Door.
Operators
The Operator says how to compare the variable with the Value. Some operators work only with numbers.
| Operator | The branch matches when the variable | Variable types |
|---|---|---|
| Equals | is the same as the value | String, Number, Boolean |
| Does Not Equal | is not the same as the value | String, Number, Boolean |
| One Of | is the same as one of the values | String, Number, Boolean |
| Greater Than | is more than the value | Number |
| Greater Than or Equal | is more than the value or the same | Number |
| Less Than | is less than the value | Number |
| Less Than or Equal | is less than the value or the same | Number |
For One Of, tap Add Value to add more values to the list. For a Boolean variable, choose True or False as the Value. For Number and String, type the value. If a String variable uses Enum, choose from its list.
Actions a branch can run
A branch can run these actions:
- Section Transition: go to another section
- Reset Story At Section: reset the story and go to a section
- Update Variable: change a variable
Only one action in a branch can move the visual novel to a section. If you add a second one, it replaces the first.
Change or delete a branch
To open the Conditional again, tap its line. Tap the + button, then tap Conditional. The box shows your branches.
- Change a branch: Tap the branch. Change it, then tap Save Branch.
- Move or delete a branch: Tap the three dots button of the branch. On desktop, you can also right-click (click with the right mouse button) the branch. Then tap Move Up, Move Down, or Delete.
Delete removes the branch at once, without asking first. Move Up and Move Down show only when the branch can move. The menu of the default branch has only Delete. When you finish, tap Submit to save your changes.
Good to know
- A line can move the visual novel in only one way. Adding a Section Transition to the line itself removes the section jumps inside the branches.