Timing

When creating automation scripts, you often need to wait for a train to arrive at a certain position or to let it drive for a specific amount of time. Model Train Script provides actions for both.

Wait

Pauses script execution for a configured amount of time.

Setting
Description

Time

The wait duration in seconds.

Random

When enabled, the actual wait time is randomly chosen between a minimum and maximum value. This adds variation to your scripts — for example, random station dwell times.

Minimum time

The shortest possible wait duration (only available when random is enabled).

circle-exclamation

Wait for condition

Pauses execution until a specified condition on your layout becomes true. This is the most reliable way to synchronise your script with the physical state of the layout.

Setting
Description

Condition

The condition to wait for. Can be based on accessories, feedback sensors, vehicle state, flags, variables, or camera detection.

Timeout

Optional confirmation time in milliseconds. When set, the condition must remain true for this duration. If the condition goes false during the timeout, the action resets and waits again.

The condition is evaluated in an event-driven way — it does not poll. As soon as the layout state changes, the condition is re-evaluated.

circle-info

The timeout setting is useful for filtering transient sensor readings. For example, if a feedback sensor briefly activates due to electrical noise, the timeout ensures the action only continues when the sensor stays active for the configured duration.

Condition types

Conditions used in "wait for condition" — and also in section and action execute conditions — can be based on:

Type
Description

Accessory

An accessory matches a specific state (e.g., a turnout is thrown).

Feedback sensor

A sensor is active or inactive, optionally occupied by a specific vehicle or the selected vehicle.

Vehicle

A vehicle's speed, direction, function state, or profile matches an expected value.

Flag

A flag is enabled or disabled.

Variable

A variable equals a specific value.

Camera

A camera detects a vehicle at a specific detection point.

All condition types support negation — you can check that a condition is not true.

Last updated