Reference Manual‎ > ‎Scripting Function Reference‎ > ‎

Signalling Function Reference

Function Names

Function names can be either:
  1. function
  2. *:function
  3. name:function
Function is the function to call; name is a name of an entity/child entity and * means entity and all child entities for (a) just the owning entity is searched for a matching function, (b) the owning entity and all descendants are searched, function is called the first component that implements the function and (c) A search is made of the owning entity and all descendants for the first called 'name' which implements function.

Signalling Function Reference

SendSignalMessage

Syntax:SendSignalMessage ( message, [argument], direction, link, index )
Function:Send a message along the track to the next/previous signal link on the track (ignoring links of the same signal). See Signal Message Types for a description of messages.
Arguments:messageThe message type

argumentAn optional string argument passed with the message

directionThe direction the script sends the message relative to the link. 1 = forwards, -1 = backwards

linkThe direction of the link that the message should be sent to, relative to the link

indexThe index of the link to send the message from
Return:Signal Found - was a signal found, End Of Track - was the end of the track encountered (rather than a circuit)
Usage:Used to communicate between signals
Special Cases:Where argument is set to the special value "DoNotForward" the receiving signal is expected not to pass forward the message.

SendConsistMessage

Syntax:SendConsistMessage ( message, [argument], direction )
Function:Send a message to passing consists. See consist message types for a list of valid types
Arguments:messageThe message type

argumentAn optional string argument passed with the message

directionNot used
Return:N/A
Usage:Only safe to use from OnConsistPassed. Used to indicate SPADs, AWS, TPWS, etc.
Special Cases:SIGMSG_CUSTOM - While the other message types are handled directly by the app, custom messages are passed on to the engine script using the script method OnCustomSignalMessage passing the argument to the engine script.

GetNextSignalState

Syntax:GetNextSignalState ( [argument], direction, link, index )
Function:Get the signal state of the next/previous signal up/down the line.
Arguments:argumentAn optional string argument passed with the message (Not used)

directionThe direction from the link. 1 = forwards, -1 = backwards

linkThe direction of the signal link 0 to look for

indexThe index of the link to start the search from
Return:The state of the next signal along the line. Where no signal is found "Go" is returned
Usage:Get the signal state of the next/previous signal up/down the line.

Set2DMapSignalState

Syntax:Set2DMapSignalState ( state )
Function:Sets the 2D map displayed state of the signal.
Arguments:stateThe state to set from (go, warning, stop)
Return:N/A
Usage:Sets the 2D map displayed state of the signal.

GetConnectedLink

Syntax:GetConnectedLink ( argument, direction, index )
Function:Get the index of the link currently connected by the track network to the link. If no link is connected then -1 is returned. Only finds links owned by the same signal
Arguments:argumentNot used

directionNot used

indexThe link to start at when looking for the next connected link. Usually 0.
Return:The index of the next link within the same signal connected via the track network, if a converging junction set against the direction of the start link is found or the end of track then -1 is returned.
Usage:This is used as a method for testing which path ahead is set, usually in response to a junction change message or when initialising
Special Cases:For slips and crossings (where the junction has two simultaneous legal paths) the dispatcher holds an internal state for the junction and as such a signal will get -1 as with a converging junction. In Freeroam and for slips set to the player's path, the state is always set for the player's route.

GetLinkCount

Syntax:GetLinkCount ()
Function:Get the number of links in the signal. Blueprint::NumberOfTrackLinks
Arguments:N/A
Return:The number of links the signal has in the range of 1 to 10
Usage:To find the number of links in the signal

GetConsistSpeed

Syntax:GetConsistSpeed ()
Function:Get the speed in metres per second of the consist currently passing the signal link
Arguments:N/A
Return:The speed in metres per second
Usage:Only safe to use from OnConsistPassed. Typically used for TPWS like systems

GetTrackSpeedLimit

Syntax:GetTrackSpeedLimit ( index )
Function:Get the track speed limit at the link
Arguments:indexThe index of the signal link
Return:The speed in metres per second
Usage:Used to test for speeding conditions in TPWS like systems

GetConsistType

Syntax:GetConsistType ()
Function:Get the class of the consist currently passing the signal link
Arguments:N/A
Return:0 = eTrainTypeSpecial,
1 = eTrainTypeLightEngine,
2 = eTrainTypeExpressPassenger,
3 = eTrainTypeStoppingPassenger,
4 = eTrainTypeHighSpeedFreight,
5 = eTrainTypeExpressFreight,
6 = eTrainTypeStandardFreight,
7 = eTrainTypeLowSpeedFreight,
8 = eTrainTypeOtherFreight,
9 = eTrainTypeEmptyStock,
10 = eTrainTypeInternational
Usage:Only safe to use from OnConsistPassed. Typically used for TPWS like systems

ActivateNode

Syntax:ActivateNode ( name, activate )
Function:Activate/Deactivate a node in a model
Arguments:namename of the node (use "all" for all nodes)
 activate1 = show, 0 = hide
Return:N/A

AddTime

Syntax:AddTime ( name, activate )
Function:Add time to an animation
Arguments:namename of the animation
 activatethe amount of time in seconds, either positive or negative
Return:The remaining time in the animation

Reset

Syntax:ActivateNode ( name, activate )
Function:Reset an animation
Arguments:namename of the animation
Return:N/A

BeginUpdate

Syntax:BeginUpdate ()
Function:Request script to get update call once per frame
Arguments:N/A
Return:N/A

EndUpdate

Syntax:EndUpdate ()
Function:Request script to end update call once per frame
Arguments:N/A
Return:N/A

GetSimulationTime

Syntax:GetSimulationTime ()
Function:Get the simulation time in seconds
Arguments:N/A
Return:Integer of the simulation time in seconds

getNearPosition

Syntax:getNearPosition()
Function:Get the position in the current world frame of the object (local coordinates are local to a moving origin centred on the camera's current tile)
Arguments:N/A
Return:The position x, y, z in metres relative to the origin

setNearPosition

Syntax:setNearPosition ( x, y, z )
Function:Set the position in the current world frame of the object (local coordinates are local to a moving origin centred on the camera's current tile)
Arguments:xThe x coordinate

yThe y coordinate

zThe z coordinate
Return:N/A