Road-hog123

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:

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:

AI_Interiorlight โ†”

0: Off, 1: On.

This is a bidirectional AI variable:

AI_Brakelight ๐Ÿ”’

The AI driver believes that the brakelights should be illuminated (0: Off, 1: On).

AI_Engine ๐Ÿ”’

  1. The AI wants the engine to be off;
  2. The AI has no opinion on the matter (perhaps because the player is driving the bus);
  3. 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:

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 Good10โ€ˆโ€‡โ€‡
Normal1โ€ˆโ€‡โ€‡
Poor0.1โ€‡
Very Poor0.01
Infinite1500000โ€ˆโ€‡โ€‡

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โ€“2Red
3โ€“5Red+Amber
6โ€“8Green
9โ€“11Amber
ElseOff

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 ๐Ÿ”’

  1. Standing
  2. Walking
  3. 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.