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
| Setting | Description |
|---|---|
| Condition | The condition to wait for. |
| Remain | Optional, 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:
| Rule | Description |
|---|---|
| Accessory | An accessory is in a specific state, for example a turnout is thrown. |
| Feedback | A sensor is active or inactive, optionally occupied by a specific vehicle or by the selected vehicle. |
| Vehicle | A vehicle's speed, direction, function or profile matches a value. |
| Flag | A flag is enabled or disabled. |
| Variable | A variable has a specific value. |
| Camera | A camera detects a vehicle at a detection point. |
| Clock | The model clock is before, at, or after a time. |
| Random | Is 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.

