Docs / Routes and rail / Trolleybuses
Script variables
The game writes these every physics step, declared in the model or not. A model may animate or make sound with them.
| Variable | Meaning |
|---|---|
Trolley_Pole<k>_Elev, _Azim |
Pole k (1, 2...): elevation over the horizontal and swing from straight back (°, + to the right) |
Trolley_Pole<k>_State |
0 down on the hook, 1 being pulled down, 2 in the hand, 3 loose, 4 on the wire with the contact open, 5 on the wire |
Trolley_Pole<k>_Contact |
1 while the shoe touches the wire |
Trolley_Pole<k>_Force |
What the shoe presses with (N) |
Trolley_Pole<k>_Bounce |
0 to 1: how hard the boom bounces on its lifting gear |
Trolley_Pole<k>_Hit |
0 to 1: how hard its last hit was (on the wire, back on it, against its rope) |
Trolley_Pole<k>_Shoe_Yaw, _Shoe_Pitch |
The head's swivel against the boom (°), so the shoe lies along the wire. Off the wire it swings back to 0 |
Trolley_Volts, Trolley_Amps |
Voltage at the bus and current from the line (negative: given back) |
Trolley_Powered |
1 while both poles are on live wire |
Trolley_Notch |
The rheostat controller's position |
Trolley_Arc |
0 to 1: how hard an arc burns now |
Trolley_Hiss |
0 to 1: the shoes' hiss |
Trolley_Battery |
Battery charge, 0 to 1 |
A model with its own poles#
Put visible 0 in each [trolley_pole] and rotate the pole meshes by Trolley_Pole<k>_Elev and
_Azim. The head (the shoe and what swivels with it) turns on top of that by _Shoe_Yaw, then
_Shoe_Pitch, about the head's pivot. _Shoe_Yaw turns about the boom's up axis (+ to the
right), _Shoe_Pitch about its side axis (+ far end up).
Example: a boom at 15° under a level
wire has _Shoe_Pitch -15, so the shoe lies level on the wire.
A script's lifting gear#
A script can run its poles' lifting gear itself, as an OMSI 2 door script runs its doors. It
declares and writes Trolley_Pole<k>_Gear, the position of the gear's carriage:
0: on the hook.1: just under the wire (the wire above it, else where the pole left the wire, else itswork_angle).
The boom rides on the carriage as a spring (boom_bounce, boom_damping), so it bounces where
the carriage stops or starts. At 1 the gear lets it go, and its spring puts the shoe on the wire.
Going below 1 from the wire takes the shoe off. At 0 the hook catches the boom once it is down.
The script times the run as it likes (a delay, a stop halfway, its speeds) and fires the run's sound itself, with its own trigger.
- The pole follows the variable from its first change until the run ends (on the wire or the hook).
- A variable left unchanged moves nothing, so a hand or the cab can still move the pole.
- A pole taken by hand leaves the script's run.
- Without the variable,
motor 1works as before.
'raise from the hook: 2 s to halfway, 3 s there, 2 s on
(L.L.gear_t) (L.S.Timegap) + (S.L.gear_t)
(L.L.gear_t) 2 < {if} (L.L.gear_t) 4 / {else} (L.L.gear_t) 5 < {if} 0.5 {else} (L.L.gear_t) 5 - 4 / 0.5 + 1 min {endif} {endif}
(S.L.Trolley_Pole1_Gear) (S.L.Trolley_Pole2_Gear)Something wrong or missing? Fix it on GitHub or open an issue.