This group of messages can be used to detect trains and monitor their progress through scenery or trackside objects. They are usually sent in pairs, one from the scenery object to the train and one in the reverse direction. This makes it possible for a train to know where it is in relation to the scenery object and for the scenery object to know where the train is.
The following events are notified (in some cases only a subset will be present). Refer to the table below to determine whether the specific event is issued for the object type you are interested in.
|Enter and InnerEnter||Occur when the centre point of the vehicle (the leading vehicle in the case of a train) enters the trigger radius.|
|Leave and InnerLeave||Occur when the centre point of the vehicle (the trailing vehicle in the case of a train) leaves the trigger radius.|
|Stopped||Occurs when a train stops within the trigger radius.|
- Where only Leave and Enter messages are produced the trigger radius is as defined in Surveyor. The exception to this is Crossings which generate their messages at a fixed radius of 300 metres.
- Where InnerLeave and InnerEnter messages are produced in addition, the inner radius is as defined in surveyor (in config.txt for scenery triggers) and the outer radius is 150 metres.
- The various objects which have this capability are listed below together with some notes on the way that these messages are generated.
|Crossings||Leave and Enter messages are generated, both are sent from the Crossing to itself.|
|Industries, Buildables, Turntables, FixedTrack||All messages are sent, for every Scenery Trigger and every Vehicle. This allows more accurate positioning information at the expense of larger numbers of messages.|
|Spline based Junctions||All messages are exchanged between Junction and Train.|
|Fixed Track Junctions||All messages are exchanged between Junction and Train. Messages are produced for each junction node rather than for the mesh object itself. The InnerEnter and InnerLeave messages occur very close to the junction and cannot be altered. If the tag 'use-named-track 1' is added to config.txt SceneryTrigger messages will also be issued.|
|Triggers||Enter, Leave and Stopped are exchanged between Trains and Triggers, but only if the tag trigger 1 is present in config.txt.|
|Trackmarks||Enter, Leave and Stopped are exchanged between Trains and Trackmarks, but only if the tag trackmark 1 is present in config.txt.|
|Track segments||Never used these, is a track defined as between junctions? When do you get EnterTrack? When do you get InnerEnterTrack?|
- The object parameter, whether it is the message source or the destination, varies in type. Sometimes it will be a train, sometimes a vehicle and sometimes neither.
- Care needs to be taken to cast to the correct object type for the particular variant of these messages being dealt with.
- Having obtained a reference to the Vehicle or the Train you can use the methods in Vehicle.gs and Train.gs to obtain further details of the object in question and its relationship to your scripted asset.