RailScript
Canvas switches
Canvas switches provide visible, project-persistent controls for manual operation, RailScript, physical feedback panels and command-station outputs. One switch keeps its visual state, BOOLEAN variable, scripts and hardware output synchronized.
Placing a switch
Right-click an empty position on the canvas and choose Place Switch. New switches can only be placed from the canvas; the Switch Manager deliberately has no Add button.
ON/OFF and PUSH/RELEASE
Choose the behaviour that matches the physical function.
- ON_OFF remains in its selected state.
- PUSH_RELEASE becomes ON when pressed and returns to OFF after the configured release time.
Size, height and visibility
A switch can be dragged and resized. Its height initially follows the nearest rail, so it appears on the matching height slice. Visible during routing controls whether it remains visible while driving; Indicator only prevents mouse operation.
BOOLEAN variable
A switch can bind to one project BOOLEAN. Operating the switch updates the variable, and changing the variable updates the switch. A read-only variable cannot be changed by the switch.
ON, OFF and PRESS scripts
An ON_OFF switch can start an ON script and an OFF script. A PUSH_RELEASE switch starts its PRESS script when pressed and its OFF/release script after release. Scripts are started through the normal RailScript runtime and appear in its logging and monitor.
Accessories and direct outputs
Output can be NONE, DEFINED_ACCESSORY or DIRECT_ADDRESS. A defined accessory uses its normal RailKernel command path and configured ON/OFF positions. Direct address sends ON/OFF to an MM or DCC accessory address on the selected command station without creating a layout accessory. Direct addressing is intended for items such as platform lights on an m84.
- Three-way turnouts cannot be controlled by a canvas switch.
- ON_OFF cannot select a decoupler.
- PUSH_RELEASE can only select a defined decoupler and cannot use a direct address.
Trigger feedback
Select an existing RailKernel feedback; its command station and complete address are reused automatically. TOGGLE_WHEN_OCCUPIED toggles on every new occupied transition. FOLLOW_FEEDBACK_STATE maps occupied to ON and free to OFF. PUSH_RELEASE responds to occupied as a physical push button and then uses its release time. The stable filtered feedback state is used.
Switch Manager
Open Define → Switch Manager to inspect existing switches. The manager shows state, variable, trigger, output and height and provides Edit, Find on canvas and Delete. Switches are still created on the canvas.
RailScript properties
Open RailScript from Switch Properties to inspect all published values. on and enabled are writable; changing on follows the same synchronization path as manual operation.
SET switch["Platform lights"].on = TRUE
WHEN switch["Tank"].on
DO
LOG "Tank switch active"
END