|
|
In this page we summarize all the capabilities of the scripts feature, divided
by layout element type.
Signals
Signals can be referred to using the following syntax:
- implicitly in the actions linked to the signals.
- by specifying the signal's coordinates: Signal(x,y)
- by using the word "next", to refer to the next signal.
- by using the name associated with the signal
| aspect |
string |
Name associated to each aspect the signal can take |
Yes |
| auto |
number |
The signal is an automatic signal |
No |
| enabled |
number |
For automatic signals, a zero value means that the signal
is in manual mode; a 1 value means that the signal is in automatic mode. |
Yes |
| switchThrown |
number |
A 1 value means that the next switch's position leads to a branch line. |
No |
| nextLimit |
number |
The value of the next speed limit that the train will see once
it travels past the current signal. |
No |
| nextLength |
number |
The distance (in meters) of the next signal. |
No |
| nextApproach |
signal |
The distant signal that the train will see once it travels past the current signal. |
No |
| nextStation |
string |
The station that the train will reach once it travels past the current signal. |
No |
| fleeted |
number |
Setting this value to 1, the signal is set to automatic mode. |
Yes |
The following actions can be associated to each signal:
| OnClick: |
the user clicks on the signal, regardless on the
current aspect of the signal. |
| OnCleared: |
the signal has been changed by the user from red to another aspect. |
| OnInit: |
the layout is loaded for the first time. |
| OnUpdate: |
another signal has changed its aspect. |
| OnAuto: |
the signal is being set to automatic mode. |
| OnCross: |
the signal is crossed by a train. |
Trains
Trains can be referred to with the following syntax:
- implicitly, in the actions associated with the train.
- by specifying the train's coordinates Train(x,y)
- by using the name associated with the train: Train(name)
| name |
string |
name of the train |
No |
| status |
string |
the current state of the train. Possible values are:
ready, running, stopped, waiting, arrived, shunting, derailed, delayed |
No |
| type |
number |
the type of the train (from 0 to 7) |
No |
| speed |
number |
the current train speed. |
No |
| length |
number |
the train length (if set in the .sch file) |
No |
| arrived |
number |
a 1 value means the train arrived at its final destination. |
No |
| stopped |
number |
a 1 value means the train is stopped at a station. |
No |
| direction |
number |
the train's direction (e-w = 0, w-e = 1, n-s = 16, s-n
= 17). The use of other direction values is discouraged, due to internal limits of the program. |
No |
| shunt |
number |
the train will start shunting when the value of this property is set.
(that is, it's only possible to write a value, not read it) |
Si |
| wait |
number |
when a train is stopped, assigning a value to this property will defer
the train's departure by the value (in seconds). This can be used to create delays in a train's schedule.
This is also a write-only property. |
Si |
The following actions can be associated to each train:
| OnEntry: |
enters the territory. |
| OnAssign: |
is assigned to another train. |
| OnStop: |
stops at a station. |
| OnStart: |
starts running from a station or a signal. |
| OnWaiting: |
stops at a red signal. |
| OnReverse: |
reverse its direction. |
| OnShunt: |
starts shunting. |
| OnExit: |
exist from the territory |
| OnArrived: |
arrives at its final destination (without exiting from the territory) |
Tracks
Tracks can be referred to with the following syntax:
- implicitly, in the actions associated with the track.
- by specifying the track's coordinates Track(x,y)
| length |
number |
length (in meter) of the track. |
No |
| color |
string |
the color of the track. Possible values:
black, white, orange, green |
No |
| busy |
number |
a 1 value means that the track is reserved |
No |
| free |
number |
a 1 value means that the track is free (black color) |
No |
| thrown |
number |
for switches, a 1 value means that the switch is not in the straight position. |
No |
The following actions can be associated to each track element:
| OnInit: |
the scenario is loaded for the first time. |
| OnSetBusy: |
the track is being reserved to allow a train's passage. |
| OnSetFree: |
the track is being freed (it is not reserved to allow a train's passage anymore). |
| OnEnter: |
a train enters in the track. |
| OnExit: |
a train leaves the track. |
| OnClicked: |
the user clicks on the track |
Itineraries
The itineraries can be referred to with the following syntax:
- implicitly, in the actions associated with the itinerary.
- by specifying the itinerary's coordinates: Itinerary(x,y)
- by using the itinerary's name: Itinerary(name)
The following actions can be associated to each itinerary:
| OnInit: |
the scenario is loaded for the first time. |
| OnClicked: |
the itinerary is activated by the user. |
Triggers
Triggers can be referred to with the following syntax:
- implicitly, in the actions associated with the trigger.
- by specifying the trigger's coordinates: Trigger(x,y)
| Train. |
train |
the train that has activated the trigger |
No |
| Track. |
track |
the track that has activated the trigger |
No |
The following actions can be associated with a trigger:
| OnInit: |
the scenario is loaded for the first time. |
| OnCrossed: |
a train activates the trigger. |
Back to the main script page
|
|