How to Use Track Triggers

From TrainzOnline
Revision as of 16:44, 27 May 2018 by Pware (Talk | contribs)

Jump to: navigation, search

Contents

What are Triggers?

Triggers are invisible markers (invisible in Driver Mode but visible in Surveyor Mode) that are placed on a track. They can be programmed to "trigger an event" when a train (any train or a specific train) passes over them in Driver Mode.

The "event" is a message from the trigger to any Session Rules that have been programmed to "listen" for the message. When the trigger event is detected, preset instructions are then executed.

TrackTrigger.JPG

(shown left) A Track Trigger in place on a track visible in Surveyor Mode. The "5.00m" is the trigger detection radius

Adding a Trigger

TrackTriggerMode.JPG

The Track Trigger is placed on the track using:-

  • the Track tool, and
  • the Trackmark Mode button.
  • Select the Trigger object from the list of installed objects
  • Click the Add Object button
  • Click the track position where the trigger is to be placed.

Configuring a Trigger

As soon as a new trigger has been placed, its properties window (shown below) will open on the screen. It will be given a default name and assigned to the currently active layer.

TrackTriggerProperties.JPG
  • To change the trigger name click on the name box, delete the highlighted default name and enter a new name.
  • To change the assigned layer click on the layer box and select a new layer.
  • Leave the "Bound Layer" at <none>.
  • To confirm the changes click on the Tick icon on the bottom right of the window.

Triggers have a "detection radius" that controls how close a train has to approach to trigger the event. The smaller the radius the closer the train. This radius is set in the Advanced Properties section of the Tools window (shown below).

TrackTriggerRadius.JPG
  • Click the Advanced Tab to open its properties.
  • Enter a new radius value in metres.
  • Click the Set Trigger Radius button
  • Click on the trigger that has been placed on the track to assign its new radius.


Note:
A small radius should only be used for slower moving trains. Fast trains may pass over a small radius trigger without being detected.

Creating a Trigger Event

Trigger events are handled by the Trigger Check Rule which is added to a session in the Session Editor.

The Trainz Wiki Link Trigger Check Rule contains detailed information on this rule.

EditSessionMenu.JPG

To add the Trigger Check Rule to a session:-

  • Open the Surveyor Main Menu.
  • Select the option Edit Session from the drop down menu list.
EditSessionWindowX.JPG

In the Edit Session window (shown left):-

  • Click the Add button

In the Rule Selection window (shown below):-

  • Scroll down the list to select the Trigger Check rule
  • Click the Tick icon.
RuleSelect.JPG


This will add the Trigger Check rule to the session.

TriggerCheck.JPG

With the Trigger Check rule highlighted (shown left):-

  • Click the Edit button. This will open its properties window.


For this example we will leave all settings unchanged and simply identify the trigger to be used.

TriggerCheckProperties.JPG


Once the trigger has been identified, click the Tick icon in the Trigger Check properties window (shown above) to accept the change.

In the Trigger Properties window (shown left):-

  • Click the Add trigger link

In the Trigger Selection window (shown below):-

  • Select the trigger you have just added
  • Click the Tick icon on the selection list
TriggerList.JPG


Adding an Instruction to the Trigger Event

To test your trigger event you will need to add at least one rule.

1. Adding a Child Rule:

TriggerAddMesPopup.JPG

When you are back in the Session Editor window:-

  • Click the Add button to add a new rule.
  • Scroll down the rule selection window to select the Message Popup rule
  • Click the Tick icon.

The Message Popup rule should now appear directly below the Trigger Check rule. It will display a red cross because it has not yet been configured.

The Message Popup Rule has to be indented so that it becomes a Child of the Trigger Check Rule and is controlled by that rule.

SessionRuleIndent.JPG

With the Message Popup Rule highlighted (shown left):-

  • Click the Indent (right arrow) button.

This should indent the Message Popup rule one level in (shown below).

SessionRuleIndented.JPG


2. Configuring the Message:

With the Message Popup Rule highlighted and indented:-

  • Click the Edit button.
MessagePopupText.JPG

The finished Message Popup.
MessagePopupStop.JPG


In the Message Popup Properties window (shown left), set the properties as shown:-
  • Check ON Close previous message popup windows
  • Select Option Button Custom text
  • Enter a short text message (you are limited to about 6 lines of text)


To add an icon to the message:-

  • Click the link click here to set (shown left) and either
    • Scroll down the Texture Asset Selection List (shown below) to find a suitable icon, or
    • Simply type "icon stop" in the text box to use one of the builtin icons.
  • Click the Tick icon.

IconStop.JPG


Again, click the Tick icon to exit the Message Popup Rule then exit the Session Editor.

Add a consist to your layout a short distance from the trigger (but further away than its radius), save the surveyor session, and then test in Driver Mode.

Another example of using the Trigger Check Rule can be found in the Message Popup Rule Applications link below.

Alternatives to the Trigger Check Rule

There are alternative rules that can be used in place of the Trigger Check Rule and triggers. A few possibilities are listed below:-

  • Directional Trigger Check Rule - identical to the Trigger Check Rule but adds the ability to test the train direction. Requires the use of a special Directional Trigger. For an example of its use see the link Controlling Signals in Sessions below.
  • Trackside Check Rule - very similar to the Trigger Check Rule but provides some different options.
  • Navigation Points (see links below) are more complex but provide more advanced controls and options.
  • Multiple Resource Check Rule - monitors and acts on changes in multiple industry or multiple wagon resource (commodity) levels.
  • Resource Verify Rule - monitors and acts on changes in a single industry or wagon resource (commodity) level.
  • Timecheck Rule - triggers an event at a set time.

Trainz Creation Tutorials:

Related Session Creation Tutorials:

Personal tools