Compatibility Notes

Christopher Lees edited this page Mar 24, 2017 · 25 revisions

Routefile Changes:

Note: These commands will not work with prior versions of OpenBVE, and whilst routefiles which use them will load, they may produce error messages or other unexpected behaviour.

Route.LoadingScreen(FileName.png)

This option allows route developers to add a custom loading screen image.

FileName.png should represent a .bmp, .png or .ace image, with a path relative to the routefile directory.

Route.DisplaySpeed(Unit,ConversionFactor)

This option allows route developers to use a custom speed in interface messages.

Unit should represent the textual string for the unit you wish to display, for example mph

ConversionFactor should represent the conversion factor between km/h and your custom unit of speed. For mph, this is 0.621371

Route.StartTime(Time)

Sets the time at which the simulation will start, independent of the time set at the first station. (Useful for creating late running scenarios)

Cycle.Rail

A rail cycle works in a similar manner to that of a ground cycle, and will rotate the railtype on a block-by-block basis.

Plugin Interface Changes:

Note: Plugins compiled for this version of OpenBVE will not work on prior versions of OpenBVE.

data.CurrentCurveRadius

Returns the current curve radius in meters at Car 0's location.

data.CurrentCant

Returns the cant value at Car 0's location.

data.CurrentPitch

Returns the pitch value at Car 0's location.

data.CurrentCameraViewMode

Returns the current camera view mode.

data.CurrentLanguageCode

Returns the current user interface language code (For use in adding translated messages if desired)

PluginManager.NetPlugin.PlaySound

This function has had a further optional parameter added- CarIndex This should be a non-negative integer, representing the car of the train which you wish to emit the sound. If this parameter is not set, then the sound will be emitted from the driver's car.

PluginManager.NetPlugin.AddMessage

This new function allows plugin developers to print a simple textual message to the in-game display, and should be used in a similar manner to the PlaySound function: https://github.com/leezer3/OpenBVE/wiki/Adding-Interface-Messages:-Code-Sample

Animated Objects Changes:

Note: Formulae using these commands will not work with prior versions of OpenBVE, and will produce error messages.

New Functions:

TrackFollowerFunction

Translates an object following the path of Rail 0. The result of this function must be a distance in meters, which for which the object's position will be translated, respecting any curves or height changes of Rail 0.

Note: Any object positioning must be done via the Position command in your animated file, not via the routefile.

Train Specific Variables:

CurveRadius[CarIndex]

Returns an average of the front and rear axle radii for the selected car.

FrontAxleCurveRadius[CarIndex]

Returns the front axle curve radius for the selected car.

RearAxleCurveRadius[CarIndex]

Returns the rear axle curve radius for the selected car.

CurveCant[CarIndex]

Returns the cant value for the selected car.

Odometer

Returns a signed number representing the distance traveled by the current car.

Odometer[carIndex]

Returns a signed number representing the distance traveled by the selected car.

Note: The odometer will reset if a car travels more than 10m in a single frame. This should only occur when jumping between stations.

Klaxon

Returns the currently playing horn (If any), as follows:

0 - No horns are playing.

1 - The primary horn is playing.

2 - The secondary horn is playing.

3 - The music horn is playing.

Note: If multiple horns are playing, then the lowest index will be returned.

Mathematical Functions

Random[Minimum,Maximum]

Returns a new random double-precision floating point number between Minimum and Maximum.

RandomInt[Minimum,Maximum]

Returns a new random integer between Minimum and Maximum.

Other Useful Functions

cameramode

This returns 0 if the camera is currently in a 2-D or 3-D cab, or 1 if in an exterior view.

currentstate

Returns the current state of the object.

Note: Functions other than StateFunction are only processed if the the current state is zero or greater.

Miscellaneous Changes:

The format of the controls.cfg file has changed. OpenBVE will detect this, and reset your controls assignments to default.

Attempting to use a newer controls.cfg file with versions 1.4.3.0 and prior will cause OpenBVE to crash. (This is out of my control, sorry)

The colon has been added as a valid separator character for time-based variables. This allows an .animated file to refer to a time directly, e.g.

[Object]
states = xsara.b3d, null.b3d
position = 0,0,0
StateFunction = if[time > 10:01, 1,0]

Panel2.cfg Additions:

A [Needle] section will now take an additional parameter: Backstop . If this parameter is set to 1 or true , then the needle's rotation will be backstopped at the minimum and maximum values.

A [Needle] section with a subject of hour , min or sec will now take an additional parameter: Smoothed . If this parameter is set to 1 or true , then the needle's rotation will be smooth, as opposed to stepped at each second, minute and hour interval.

New Subjects:

The following new subjects are available:

Klaxon - Returns the index of the lowest currently playing horn/ klaxon.

PrimaryKlaxon - Returns 1 if the primary klaxon is currently playing, 0 otherwise.

SecondaryKlaxon - Returns 1 if the secondary klaxon is currently playing, 0 otherwise.

MusicKlaxon - Returns 1 if the music klaxon is currently playing, 0 otherwise.

The LinearGauge Section

It is now possible to create a linear gauge, which uses texture shifting to move a needle horizontally or vertically. This behaves in the same manner as a Needle section (see the documentation), other than having an additional parameter of Width , which sets the width of the needle, in order to avoid it wrapping around.

B3D / CSV Object Changes:

The parameter WrapMode (B3d) / SetWrapMode (CSV) is now supported to control the openGL wrap mode a texture uses. Valid values are as follows:

  • RepeatRepeat
  • ClampRepeat
  • RepeatClamp
  • ClampClamp