Rail3D*

   

 

Document


 


On this page…

  1. 1 Entry Points
  2. 2 Functions

An object representing the layout.

 

1 Entry Points

OnLocation()

Function is called when a train location (the stored location string) changes. This can occur with stops and reverses as well as with location features.

  • Object “Train” is automatically declared and may be used to access the current train object.
  • If string “Location” is declared in the script it will be set to the location name text.

Note that the function may be called multiple times for each location/stop/reverse feature.

 
OnStop()

Function is called when a train stops at a stop.

 
  • Object “Train” is automatically declared and may be used to access the current train object.
  • If string “Location” is declared in the script it will be set to the location name text.
 
OnReverse()

Function is called when a train reverses at a reverse feature.

 
  • Object “Train” is automatically declared and may be used to access the current train object.
  • If string “Location” is declared in the script it will be set to the location name text.

The script function is called after the normal reverse code, so the script is able to modify route names, timing etc.

 
OnUncouple()

Function is called when a train uncouples.

 
  • Object “Train” is automatically declared and may be used to access the current train object.
  • If string “Location” is declared in the script it will be set to the location name text.
 
OnCouple()

Function is called when a train couples.

 
  • Object “Train” is automatically declared and may be used to access the current train object.
  • If string “Location” is declared in the script it will be set to the location name text.
 
OnCanShunt()

Function is called when the train passes a “Shunt” track marker.

 
  • Object “Train” is automatically declared and may be used to access the current train object.
  • If string “Location” is declared in the script it will be set to the location name text.
 

2 Functions

ClearAll(void);

Clears the document - equivalent to File/New.

 
SetSaveTriangles(BOOL);

Sets or clears the documents “Save Triangles” property.

 
Triangulate(void);

Runs a terrain triangulation operation.

 
Merge(string);

Merges the specified file with the current document

 
Load(string);

Loads the specified file.

 
void SetTrackType(string type);
void SetDefaultTrackType(string type);

Sets the current/defualt track type.

 
BuildLink(float a,float b,float c,float d,float e,float f);

Builds new track from point a,b,c to point d,e,f. If nodes pre-exist at these points the track will be joined up, otherwsie new nodes are created. Note that scripts are very precise with node locations and do not snap to the nearest point within a metre radius

 
LinkNodes(float a,float b,float c,float d,float e,float f);

Builds new track from point a,b,c to point d,e,f nodes must pre-exist.

 
DeleteFeature(string FeatType,float a,float b)

Deletes a feature of the specified type from the node at location a,b.

 
float GetLineSpacing(void);

returns the current line spacing parameters for the document.

 
node GetMarker1(void);
node GetMarker2(void);

returns a node object for the current marker 1 or marker 2 node.

 
signal GetSig(int x,int y);

Gets the signal at the specified position. May return a null value if no signal at specified position.

 
signal GetSigByID(string);

Gets the specified signal by its signal id. May return null if signal not found.

 
panel GetPanel(string panel);

Returns the panel with the specified name.

 
node GetNode(float x,float y);

returns the node at the specified position, or null if node not found

 
node GetCurrentNode(void);

returns a node object for the current selected node.

 
int GetHour(void);
int GetMin(void);
int GetSec(void);

Returns the simulation time.

 
void SetTime(int h,int m)

Sets the current simulation time.

 
void RunGlobalScripts(void);

Runs a Global script.

 
float GetTerrainHeight(float x,float y)

returns height of terrain at specified position.

 
train FindTrain(string sRoute)

v108

Returns a reference to the specified train, or null if not found.

V110: accepts wildcards in sRoute, eg "1A*" to match all trains starting "1A"


 


MRG 30/12/2014 17:33:08