BETA — Preview build
Skip to content
Pause until a condition becomes true, such as a sensor or a signal state

Wait for condition ​

Pauses the script until a condition on your layout becomes true, for example until a train reaches a sensor or a signal turns green. This is the most reliable way to keep a script in step with what really happens on the layout.

Settings ​

SettingDescription
ConditionThe condition to wait for.
RemainOptional, in milliseconds. When set, the condition must stay true for this long before the script continues. If it turns false in the meantime, the action starts waiting again.

How it works ​

  • When the condition is already true when the action starts, the script continues right away.
  • The condition is checked again every time something on the layout changes. There is no polling and no delay.
  • Remain filters out short glitches: a sensor that flickers for a moment because of a dirty wheel or electrical noise does not end the wait. Most feedback modules already filter this in hardware; if yours don't, a value of around 100 ms is usually enough.
  • There is no time limit: the action waits as long as it takes.

What you can wait for ​

The condition can combine any of these rules:

RuleDescription
AccessoryAn accessory is in a specific state, for example a turnout is thrown.
FeedbackA sensor is active or inactive, optionally occupied by a specific vehicle or by the selected vehicle.
VehicleA vehicle's speed, direction, function or profile matches a value.
FlagA flag is enabled or disabled.
VariableA variable has a specific value.
CameraA camera detects a vehicle at a detection point.
ClockThe model clock is before, at, or after a time.
RandomIs true with a chosen probability.

Every rule can be negated, so you can also wait until something is not the case. See Conditions for how to combine rules with AND and OR.

Example ​

A train departs from the station. The script sets the speed, then uses Wait for condition with the rule "Sensor Block 3 is active" to wait until the train reaches the next block, and then slows the train down.