BETA — Preview build
Skip to content
Run different actions depending on the state of your layout

Condition ​

The condition action lets a script make a decision. It checks one or more conditions and runs only the actions that belong to the first one that is met, just like if / else if / else in a programming language.

Settings ​

SettingDescription
NameOptional. Describes what the condition decides, for example "Signal aspect". The name is shown in the script editor instead of the generic "Condition".
If / ThenThe first condition and the actions to run when it is met.
Else ifOptional extra branches, each with its own condition and actions. Add as many as you need with Add else if.
ElseThe actions to run when none of the conditions are met. Leave it empty to do nothing.

How it works ​

  • The branches are checked from top to bottom at the moment the action runs. Only the first branch whose condition is met runs; the others are skipped, even if their condition is met as well.
  • When no branch matches and Else is empty, nothing happens and the script continues with the next action.
  • The actions inside a branch can have their own execute conditions, and can be any action, including another condition or a group.
  • A branch with an empty condition is always met. Use this deliberately, or make sure every branch has at least one rule.

INFO

The condition is checked once, when the action starts. If you want to wait until something becomes true, use Wait for condition instead.

Example ​

A train approaches a signal and should react to its aspect:

  • If signal S1 is red, then stop the train.
  • Else if signal S1 is yellow, then set the speed to 30%.
  • Else keep driving.