Rail3D*


 

Signal


 


On this page…

  1. 1 Entry Points
  2. 2 Functions
 

1 Entry Points

OnTrain()

Function is called when a train passes the signal.

  • Object “Train” is automatically declared and may be used to access the train object.
  • Object “Signal” is also declared and may be used to access the signal.
 
OnSetLamps()

Function is called when the state of the signal changes and the signal is in view – or when the signal comes into view and the state has changed. Thus this function is called when the lamp colours / states may need to be changed.

 
OnSignalCanRouteTo()

Function is called when another signal tries to lock a route to the signal. The script may return false to prevent the route being set or true to allow the route.

 
OnSignalCanClear()

Function is called when a signal is about to set a route (And normal conditions for route setting have been met) The script may return false to prevent the route being set or true to allow the route.

 

2 Functions

float GetX(void)
float GetY(void)

returns position of signal.

 
string GetType(void)
void SetType(string) 

returns type of the signal or sets signal type

 
int IsOn(void)
int IsCau(void)
int IsCau2(void)
int IsJct(void)
int IsJct2(void)
int IsShunt(void)

return state of signal true/false

 
int IsClear(void)

returns true if signal is completely clear, ie not jct and not Cau etc

 
int IsHidden(void)

returns true if signal is a hidden signal.

 
void SetLamp(int LampID,int r,int g,int b,int f)

Sets state of lamp specified by LampNum (from 1 to n) to colour r/g/b and flashing on/off (f).

 
void UnsetLamp(int LampID)

Clears setting of state of lamp specified by LampNum. Control of the lamp reverts to normal state table.

 
void SetArm(int ArmID,int angle)

Sets position of specified arm (semaphore signals).

 
void UnsetArm(int ArmID)

Clears setting of arm position. Control of the lamp reverts to normal state table.

 
signal NextSignal(void)

Returns the next signal.

Note that there is not always a next signal, for example if the signal is on the next signal is not set.

 
signal PrevSignal(void)

Build 102.3 onwards

Returns the previous signal.

Note that there is not always a previous signal, and this is only designed to work on plain line, so signals on junction routes may not be returned.

 
SetLockThrough(bool);

Sets the signal into lock through mode (true) or not lock through mode (false).

 
Bool IsLockThrough(void)

Returns true if the signal is in lock through mode.

 
SetHold(bool);

Sets the signal into hold mode (true) or not hold mode (false).

 
ResetHoldCount(void);

Resets the number of releases on the signal to zero

 
bool IsHold(void);

returns true if the signal is a hold signal

 
int GetHold(void);

returns current release count for a hold signal

 
string GetID();
void SetID(string);

Gets or sets signal id string

 
float GetDistance(train);

returns the distance between the signal and an approaching train.

 
link GetRearLink(void);
link GetAdvanceLink(void);

returns a link object for the track section immediately in advance of (ahead) or rear of (before) the signal.

 
string GetRouteLabel(void);

returns the name of any Route Tag found on the signals set route.

 
float GetRouteLimit(void);

returns the lowest link speed limit on the signal’s set route (or zero if no limit applies)

 

See Also


 

 


MRG 14/12/2013 09:46:43