openOMSI GitHub Discord

Docs / Routes and rail / Trolleybuses

Switch displays

1 min readEdit this pagedocs/TROLLEYBUS.md

A map author can use a scripted scenery object as a switch display. Declare these numeric variables in the object's [varnamelist]; the engine supplies them before its script runs:

Variable Value
Trolley_Frog_State 0: no matching switch, 1: set to the left leg, 2: set to the right leg, seen from the toe
Trolley_Frog_Straight 1 if the selected leg is the switch's straight way, otherwise 0
Trolley_Frog_Changed Simulation seconds since the switch last changed; 1000000 initially or without a switch

The object must declare Trolley_Frog_State to opt in. A placed object's string matching a [trolley_switch] name selects that switch (case-insensitive, ignoring surrounding spaces). Otherwise it shows the nearest switch within 40 m horizontally. Name displays explicitly at closely spaced junctions so they do not bind to a neighbouring switch.

These values report the actual retained switch position, not the dashboard request. They work for radio, indicator, power and fixed switches, and can drive [visible], [matl_change] or an OMSI script. For example, a left-bar mesh can use:

[visible]
Trolley_Frog_State
1

The right-bar mesh uses value 2. The map supplies the housing, symbols and any blink animation; no display model is generated by the engine. The display timer advances once per scenery simulation step, independently of the number of vehicles. Repeating the same request or rejecting a request during the switch lock does not reset it.

The network becomes available when a vehicle loads the map's wire and remains available after that vehicle is removed. Existing add-on signs that predict a request keep their own behavior until their scripts are adapted to these variables.

Something wrong or missing? Fix it on GitHub or open an issue.

↑↓ to move↵ to open