Predefined Local Variables
These, like System Variables, are already declared in /program and have
๐ indicates a read-only variableโyou can still save to it, but OMSI will ignore and overwrite your input.
Vehicles
Articulated buses typically use the Scriptshare System where multiple vehicles share the same variable memoryโit's important to note that even though the NG272's trailer is a vehicle with a single axle, that axle is index 2.
Float Variables
These are declared in /program/varlist_roadvehicle.txt, except for a new feature in OMSI 2: On-Demand Predefined Local Variables whichโonce declared in your own varlist(s)โhave predefined behaviour that overwrites any stored value.
Refresh_Strings
Set this variable to 1 to tell OMSI that one or more strings that are displayed on text textures have been modified and so it should recreate all text textures. OMSI will set it back to zero at the start of each frame.
For testing/debug purposes you can set this variable every frame, but creating text textures has a performance impact so you should try to do so only when the text has actually changed.
Envir_Brightness ๐
The ambient brightness of the environment around the vehicle; varies from 0 (dark) to 1 (light).
While this is unlikely to be useful in a script, it is used by the default buses (and some trains/buildings) to vary the intensity of the envmap (fake environment reflections) according to the brightness of the environment that is being "reflected".
StreetCond ๐
How wet the road surface is, for the purpose of varying the sounds that make the road sound wet. Varies between 0 (dry), 1 (saturated) and 2 (entire road is a puddle).
Spot_Select
Only one [spotlight] can be active and illuminating the map at any one time; set this variable to the zero-based index of the one you want active, or -1 if the headlights are turned off.
Colorscheme ๐
Index of the active livery. This is either the livery the player chose, the livery assigned to the vehicle in the AIList or a random value.
Most commonly used as the input to [CTC]. It is also used on the default VW T3 van to enable the blue beacons when the police livery is active, but [setvar] is a better choice for this kind of behaviour, especially for any use case where the number and order of liveries is not predictable.
M_Wheel
The total torque delivered to the driven axles by the drivetrain in kNm. OMSI decides how this torque is divided amongst the driven wheels.
n_Wheel ๐
The Official Wiki documents this as the average wheel speed of the vehicle in revolutions per minute, but the way it is used implies it should be the average wheel speed of the driven axles, i.e. the speed of the driveshaft multiplied by the final drive ratio.
Throttle, Brake & Clutch ๐
The throttle, brake and clutch pedal inputs respectively, all varying between 0 (released) and 1 (fully depressed).
Brakeforce
The total braking torque applied to all axles in Newtons. That's not a typoโthe official wiki links to the Wikipedia page for the Newton and not Newton-metre.
You can instead use the Axle_Brakeforce variables, especially if you want to simulate anti-lock brakes. You should not use both at the same time.
Velocity ๐
Vehicle speed (km/h) based on the wheel rotation. Can be used to drive the speedometer if you don't want to use the driveshaft speed.
Velocity_Ground ๐
Vehicle speed (km/h) relative to the world, irrespective of wheelspin or slide, akin to GPS speed (but without simulation of real-world GPS inaccuracies).
tank_percent
Fuel level (0โ1) for display on the red line.
kmcounter_km & kmcounter_m ๐
Variables for driving the odometer, automatically initialised based on [kmcounter_init] and incremented as the vehicle drives. Each time kmcounter_m would tick over 1000 it instead resets to 0 and kmcounter_km is incremented.
In addition to driving the odometer, you can use kmcounter_m to track distance travelled since some event like a bus stopโthe X10 devs used this to automatically trigger next stop announcements while approaching a stop rather than when OMSI detects you've left the previous stop. TODO: Tutorial.
relrange ๐
Introduced on a test basis. Do not use!
Driver_Seat_VertTransl ๐
Deflection of the air-sprung driver's seat (metres).
Wheel_Rotation_#_L & _R ๐
Angle of rotation (radians) of the specified wheel for animation purposes. # is the axle index (0โ3).
Wheel_RotationSpeed_#_L & _R ๐
Rotation speed (revolutions per minute) of the specified wheel. # is the axle index (0โ3). Useful for anti-lock brake simulation.
Axle_Suspension_#_L & _R ๐
Suspension deflection (metres) of the specified wheel, both for animation purposes and for air suspension simulation. # is the axle index (0โ3).
Axle_Steering_#_L & _R ๐
Steering angle of the of the specified wheel for animation purposes. # is the axle index (0โ3).
Notably there's no steering input variable, so despite varying based on the position of the axle relative to the rotation point and the turning circle diameter, this is the only way to animate the steering wheel. Fortunately for this purpose Ackermann steering geometry is not simulated, but that means you could be the first (that I know of) to simulate it yourself and animate the wheels correctly!
Axle_Springfactor_#_L & _R
Multiplier for the spring rate of the specified wheelโvehicles with air suspension will automatically adjust the pressure in the pneumatic springs to try and maintain a constant ride height. # is the axle index (0โ3).
If you're feeling adventurous you could try writing your own suspension script that simulates the non-linear spring rate of pneumatic springs and replaces the continuous horizontal levelling of the default scripts with proper anti-rollbar simulation. ๐
Axle_Brakeforce_#_L & _R
Set the brake force applied to a specific wheel in Newtons. # is the axle index (0โ3).
The unit is not a typoโthe official wiki links to the Wikipedia page for the Newton and not Newton-metre.
You can instead use the Brakeforce variable if you don't want to simulate anti-lock brakes. You should not use both at the same time.
Axle_SurfaceID_#_L & _R ๐ ๐
Added in version 2.00. This is an "on-demand" variableโyou must define it yourself, but once defined OMSI will write to it.
Retrieve the surface type code (asphalt, grass, snow, etc.) under the specified wheel. # is the axle index (0โ3).
Unused by the default vehicles, but presumably either someone asked for this feature or the devs thought it was a cool idea. You could adjust the tyre/road noise sounds based on the underlying surface, much like StreetCond with surface wetness.
Debug_0โ5
Debug variablesโdisplayed when running the game in debug mode.
A_Trans_X, A_Trans_Y & A_Trans_Z ๐
Translational accleration (ms-2) in each of the three axes.
The default buses mix the values of all three to control the volume of the rattling sounds, X and Y are used to move an unlatched cockpit door, and apparently the large mudflap on the back of the O305 is affected by acceleration... I have seen grab handles animated too.
AI ๐
0: Player-controlled bus, 1: AI-controlled bus.
This is used in the case that the player hands off control of their bus to the AI, they focus an AI bus, or the bus doesn't have a {frame_ai} entrypoint.
AI_Blinker_L & AI_Blinker_R โ
0: Off, 1: On.
This is a bidirectional AI variable:
- When the player is driving the bus, set these variables based on the indicator and hazard light controls so the AI traffic knows what the player intends;
- When the AI is driving the bus, OMSI will set these variables based on the AI driver's intentions.
There exists a bug where the AI will briefly indicate the wrong direction in some scenarios, I'm not sure if anyone has figured out a workaround yet.
AI_Light โ
0: Off, 0.5: Parking/Side lights, 1: Headlights, 2: Full beam/Flash.
This is a bidirectional AI variable:
- When the player is driving the bus, set this variable based on the headlight controls so the AI knows what the player intends;
- When the AI is driving the bus, OMSI will set these variables based on the AI driver's intentions.
AI_Interiorlight โ
0: Off, 1: On.
This is a bidirectional AI variable:
- When the player is driving the bus, set this variable based on the interior lighting controls so the passengers know when to complain about the darkness;
- When the AI is driving the bus, OMSI will set these variables based on the AI driver's intentions.
AI_Brakelight ๐
The AI driver believes that the brakelights should be illuminated (0: Off, 1: On).
AI_Engine ๐
- The AI wants the engine to be off;
- The AI has no opinion on the matter (perhaps because the player is driving the bus);
- The AI wants the engine to be on.
AI_target_index ๐
The zero-based index of the terminus in the HOF file for the destination the AI driver of a scheduled vehicle is trying to get to, used in conjunction with system trigger ai_scheduled_settarget.
target_index_int
Tell the passengers where the bus is goingโzero-based index of the terminus in the HOF file, as above.
AI_Scheduled_AtStation โ
This is a bidirectional AI variable:
- When the AI arrives at a bus stop it sets this variable to 1 to open the doors;
- When the AI is ready to depart it sets this variable to -1 to close the doors;
- When the doors are closed, locked, etc. the script sets this variable to 0 to let the bus continue.
AI_Scheduled_AtStation_Side ๐ ๐
Added in version 2.00. This is an "on-demand" variableโyou must define it yourself, but once defined OMSI will write to it.
Tells the door script which side the doors should be opened, particularly useful in the case that the vehicle is a train or bi-directional tram. 0: nearside, 1: offside, 2: both.
PAX_Entry#_Open
Tell the passengers whether the entrance with index # (0โ7) is open (1) or closed (0).
PAX_Exit#_Open
Tell the passengers whether the exit with index # (0โ7) is open (1) or closed (0).
PAX_Entry#_Req
Added in version 1.03.
True if at least one passenger wants to enter through the entrance with index # (0โ7).
Useful for buses where you can request to enter through rear doors with an exterior button, or for trains/trams where the driver doesn't open all the doors at every station.
PAX_Exit#_Req
Added in version 1.03.
True if at least one passenger wants to leave through the exit with index # (0โ7).
Useful for buses with multiple automatic exit doors, or with multiple stop request indicators. Unlike system trigger int_haltewunsch this maintains a constant value from the first request to the last passenger disembarking.
GivenTicket
Set this to the zero-based index of the ticket that has just been printed by a ticketprinter, -1 otherwise. (I have not tested if this is automatically reset to -1 if the passenger takes the ticket)
humans_count ๐
Number of passengers onboard.
Useful for calculating the heat/moisure contribution to the heating simulation, or to adjust the volume of a "passenger chatter" sound.
FF_Vib_Period
The period (seconds, inverse of frequency in Hz) of the force-feedback vibration.
FF_Vib_Amp
The strength of the force-feedback vibration (0โ1).
Snd_OutsideVol
Tell OMSI how loud the outside sounds should be on the inside of the vehicle, based on the number of open doors and windows. 0: Silent, 1: You are outside.
Snd_Microphone
Should the player's microphone be active?
Even the manual acknowledges that manually making announcements serves no in-game purpose, but you can still speak to the void.
Snd_Radio
Should the Internet Radio be active?
Cabinair_Temp
Temperature (โ) of the air inside the bus; the main output of the heating simulation.
Cabinair_absHum
The Absolute Humidity (gm-3) of the air inside the bus; the other output of the heating simulation.
Cabinair_relHum ๐
OMSI automatically calculates the Relative Humidity of the air inside the bus from the above two variables.
PrecipRate ๐
Same as the system variable of the same name.
PrecipType ๐
Same as the system variable of the same name.
Dirt_Norm ๐
The dirtiness of the exterior of the bus (0โ1).
DirtRate ๐
The rate of dirt accumulation on the exterior of the bus in dirtiness per second (i.e. a value of 0.5 indicates the bus goes from clean to maximally dirty in 2 seconds).
This variable is used to simulate dirt accumulation on parts of the bus that the driver can clean, namely the area wiped by the windscreen wipers.
schedule_active ๐
Is there an active timetable (useful to toggle the display of the timetable mesh).
train_frontcoupling ๐
True if something is coupled to this vehicle's front coupling.
train_backcoupling ๐
True if something is coupled to this vehicle's back coupling.
train_me_reverse ๐
Individual vehicles in trains can be reversed, this variable is true for those vehicles.
TrafficPriority
Added in version 2.00.
Emergency service vehicles can set this variable true when their blue lights are active to tell the AI to get out of the way.
The AI cannot leave their path to get out the way, so this feature can cause havoc at traffic light controlled junctions as the priority vehicle pushes other AI through red lights. Map makers wishing to use emergency service vehicles should restrict them to areas where they cannot push traffic across level crossings or into problematic conflict like at single-file roadworks.
TrafficPriorityWarningNeeded
Added in version 2.00?
This variable is listed in the varlist but is not documented on the official wiki or used by any default vehicles.
wearlifespan ๐
Added in version 2.00.
The value of the "Maintenance Condition" setting:
| Very Good | 10โโโ |
|---|---|
| Normal | 1โโโ |
| Poor | 0.1โ |
| Very Poor | 0.01 |
| Infinite | 1500000โโโ |
articulation_0_alpha & articulation_0_beta ๐ ๐
Added in version 2.00. This is an "on-demand" variableโyou must define it yourself, but once defined OMSI will write to it.
Angle (degrees, ยฐ) at which the zeroth articulation joint is bent around the vertical (alpha) and transverse (beta) axes. Articulated buses cannot articulate in the roll axis.
Technically 0 is an index and can be increased to at least 1โas far as I know there has only been one bi-articulated bus made for OMSI, and I'm sure it has at least twice the jank that the single-articulated buses have.
boogie_#_wheel_at_limit ๐ ๐
Added in version 2.00. This is an "on-demand" variableโyou must define it yourself, but once defined OMSI will write to it.
The proximity of the flanges of the wheelsets of the bogie with index # to the railโ0 indicates the wheelset is centred, ยฑ1 indicates flange-rail contact and flange squeal.
boogie_#_invradius ๐ ๐
Added in version 2.00. This is an "on-demand" variableโyou must define it yourself, but once defined OMSI will write to it.
The inverse of the curve radius (m-1) under the bogie with index #.
contactshoe_#_rail_pos_x & _y ๐ ๐
Added in version 2.00. This is an "on-demand" variableโyou must define it yourself, but once defined OMSI will write to it.
contactshoe_#_rail_index ๐ ๐
Added in version 2.00. This is an "on-demand" variableโyou must define it yourself, but once defined OMSI will write to it.
contactshoe_#_volt_rail ๐ ๐
Added in version 2.00. This is an "on-demand" variableโyou must define it yourself, but once defined OMSI will write to it.
contactshoe_#_volt_veh ๐ ๐
Added in version 2.00. This is an "on-demand" variableโyou must define it yourself, but once defined OMSI will write to it.
contactshoe_#_freq ๐ ๐
Added in version 2.00. This is an "on-demand" variableโyou must define it yourself, but once defined OMSI will write to it.
String Variables
These are declared in /program/stringvarlist_roadvehicle.txt.
ident ๐
Vehicle registration plate, e.g. B-V 3503.
number ๐
Vehicle number, e.g. 3503.
act_route
Not used.
act_busstop ๐
The bus stop name (as defined in the Editor) of the current/next bus stop, used in conjunction with system trigger ai_scheduled_setbusstop.
SetLineTo ๐
The line number (which can include letters and symbols), used in conjunction with system trigger ai_scheduled_settarget.
yard ๐
The internal name of the active HOF file.
file_schedule ๐
File path of the automatically-generated Timetable Bitmap, e.g. Temp_Schedules\1234.tbmp.
TODO: figure out how to decode the filename, the first digit might be the day of the week?
Sceneryobjects
Float Variables
These are declared in /program/varlist_scenobj.txt.
NightlightA ๐
True if it is dark enough for street or interior lighting to be turned on. The behaviour of this variable is affected by [[NightMapMode]][NightMapMode]โif the building is not InUse then this variable will not be true even if it is dark enough.
In addition to street/building lighting this is used to mute the escalator sounds at the default subway stations... are they solar-poweredโฝ
InUse ๐
True if the building is in active use; the times of day when this is true depends on the type of building set with [[NightMapMode]][NightMapMode].
This is used to mute the sounds eminating from the default school gymnasiums outside school hours, on weekends and during school holidays.
I have not tested the behaviour of this variable in "street lighting" (default) or "continuous lighting" modesโin theory it should be on all the time?
TrafficLightPhase ๐
The current phase of the traffic light sequence this object is parented to. If this object is not parented to a traffic light sequence then it will always be zero.
| 0โ2 | Red |
| 3โ5 | Red+Amber |
| 6โ8 | Green |
| 9โ11 | Amber |
| Else | Off |
The Crossing Editor can only set a value of 12 for Off, but in theory you could specify any value you wanted in the junction object config file.
TrafficLightApproach ๐
If the sequence is configured to detect the approach of a vehicle this variable will turn true when an approaching vehicle is detected.
The "A" symbol on the bus-only traffic lights at Reimerweg is controlled using this variable.
Colorscheme ๐
Outdated
Not sure if that means non-functional, but it would function the same as the vehicle variable of the same name.
Signal ๐
The signal indication for this signal, as configured in the signalroutes file.
NextSignal ๐
The signal indication of the next signal, as configured in the signalroutes file.
Refresh_Strings
Same as the vehicle variable of the same name.
Switch
Added in version 2.00.
Select which path at a railroad switch is active.
Humans
Float Variables
These are declared in /program/varlist_human.txt.
LastMovedDist ๐
Distance (metres) moved in the last frame, used for the old animations.
PAX_State ๐
- Standing
- Walking
- Sitting
HeightOfSeat ๐
Distance (metres) between the seat cushion and the ground, used for the old animations.
Colorscheme ๐
Same as the vehicle variable of the same name.