If,ElseIf,Else,EndIf


You can use the ‘If’ branching command within the scenario sheet to make it process a specific range of commands or not as you wish.

Sample

Reference

Command Description Arg1 Arg2 Arg3 Arg4 Arg5 Arg6
If Starts ‘If’ clause Logical expression for determining ‘if’ value
ElseIf Starts ‘ElseIf’ clause Logical expression for determining ‘if’ value
Else Starts ‘Else’ clause
EndIf Ends ‘If’ clause

If-ElseIf-Else-Endif

It always needs to start with ‘If’ and end with ‘EndIf’.

Command Arg1 Description
If flag1
…Any command If the ‘If’ condition (flag1) is true, it runs these commands
…Any command Can set multiple commands
ElseIf flag2
…Any command If the ‘ElseIf’ condition (flag2) is true, it runs these commands
…Any command Can set multiple commands
Else
…Any command If neither the ‘If’ or ‘ElseIf’ condition are true, it runs these commands
…Any command Can set multiple commands
EndIf

In this way, you can use the ‘If’ set of commands to execute different blocks of commands based on specific conditions.

When ‘If’ Branches are Not Recommended

‘If’ branching is generally not recommended. The reason is that they pose the restrictions shown below, which can be hard to understand and are likely to cause execution problems:

  • They cannot tell accurately if a page has already been read or not.
  • They must not be used when skipping over scenario labels.

We generally recommend using conditional jumps as they allow you to implement the same functionality; however, ‘if’ branching can be easier to write, and this is why it is available for your convenience.
In addition, if you want to change clothing within the same scenario, or change a character’s gender based on user input, we recommend using the Conditional setting in the Character sheet and Texture sheet.