Vehicle control
This chapter describes the actions available for controlling your trains.
Select vehicle
All vehicle control actions require a vehicle to be selected first. The select vehicle action sets the active vehicle for all subsequent actions in the script.
You can select a vehicle in two ways:
Manual — Enter the DCC address, speed steps, and name directly. This is useful for vehicles not in your catalog.
When you select a new vehicle, the previously selected vehicle is released. Only one vehicle can be active at a time within a script.
Select from feedback
The select from feedback action reads the vehicle address from a feedback sensor on your layout. This requires RailCom-capable hardware.
Feedback sensor
The feedback sensor to read the vehicle address from. Select from your layout.
Wait for occupancy
When enabled, the action blocks until a vehicle is detected on the sensor. When disabled, the action reads the current state immediately.
Flags from catalog
When enabled, if the detected address matches a vehicle in your catalog, that vehicle's flags are applied to the script context.
This action is particularly useful for event-triggered scripts where you don't know which vehicle will arrive at a sensor.
Set speed
Sets the speed of the selected vehicle as a percentage (0–100), where 0 is stopped and 100 is full speed. The percentage is converted to the actual speed step value based on the vehicle's configured speed steps (14, 28, or 128).
The current direction of travel is maintained.
Stop vehicle
Immediately sets the speed of the selected vehicle to 0. No configuration required — the current direction is maintained.
Set direction
Explicitly sets the direction of travel for the selected vehicle to forward or reversed. The current speed is maintained.
Toggle direction
Reverses the current direction of travel. No configuration required — the current speed is maintained.
Set function
Triggers a specific function of the selected vehicle. You can turn a function on or off, and there are two ways to identify which function to control:
By icon — Model Train Script finds the first function on the active vehicle that matches the configured icon (e.g., whistle, horn, light). This allows you to create vehicle-independent scripts — the same script works with different vehicles as long as they have functions with matching icons.
By function — You specify the exact function by selecting it from a catalog vehicle. This gives you precise control over which function is triggered, including its type (toggle, pulse, or timed).
When a function is configured as pulse type on the vehicle, the action automatically sends a momentary trigger regardless of the on/off setting.
Set profile
Applies a predefined vehicle profile to the selected vehicle. A profile is a shortcut that sets speed, direction, and functions in a single action.
Available profile types:
Idle
Stopped, ready state
Shunting
Low-speed shunting operations
Slow
Slow cruising speed
Medium
Medium cruising speed
Fast
High-speed operations
The exact speed, direction, and function values for each profile are defined per vehicle in the vehicles configuration.
Store state
Saves the complete state of the selected vehicle — speed, direction, and all function states — for later restoration. No configuration required.
The stored state persists within the current script run and can be restored at any point later in the script.
Restore state
Restores the vehicle state previously saved by store state. All function states are reapplied individually, followed by speed and direction.
A typical use case is a slow-speed section: before entering, store the state and set a lower speed. After the train exits, restore the state to resume at the original speed with all functions intact.
Last updated