Junction Action Editor

The Junction Action Editor is a dialog for creating and editing junction actions. To bring it up, (a) using the track edit tool, right-click a junction and choose Action..., or (b) double-click a row in the Junction Actions tab in Script Central.  Either way, the dialog comes up with reference to a specific junction, where there might be one or more actions defined to trigger on different events.

The dialog is modeless, so it can remain on the screen while you work on the layout.  You can move around to different junctions (or change your selection in Script Central) and change what junction the dialog is showing.  The dialog works on one action at a time, with arrow keys for moving through the list of actions at the junction.

The Junction Action Editor is a good place to develop action scripts, but unlike the Script Editor, it is not a place to run or test them.  There are no Play or Stop buttons in this dialog.  To test a junction action, you have to run a suitable car across the junction.

Junction Action Triggers

A junction action begins execution when some train or car passes across it.  You can choose what triggers the action -- a specific car or train, or a class of them.  The list of choices for trigger type is as follows, where the first column is the name, second tells what kind of argument is required if any, third shows what will actually trigger the action:

Any Train  

first car of any train

Car car id car with specified id (id = label)
AAR aar code car with aar code matching (or starting with) specified code
Train train id first car of train with specified id (id = name or train+no)
Train Type train type train of type Freight, Passenger, Mixed, or Switcher, as assigned by the program
Any Last Car   last car of any train
Last Car Of train id

last car of train with specified id

Any Car  

any car of any train

A trigger has both a type and a trigger direction.  Consider a track going horizontally across the screen, with a junction in the middle:  a train can cross it from left to right (W->E) or the other way (E->W).  You can specify whether an action is to be triggered by one or the other or both.

The orientation of the layout is taken into account at the time you assign a direction to a trigger.  If travel across the junction is more or less horizontal, then the choices you have are W-E or E-W; if closer to vertical, they become N-S or S-N.  (If you assign a direction and later rotate the layout, results are unpredictable.  If it triggers the wrong way, change it to the other.)

For additional notes regarding triggers, see Working With Junction Actions.

Dialog controls:

The Junction Action Editor is always working on a single action.  If you bring it up on a junction having no action, it creates an empty one with a default trigger.

Label

Upper left of dialog indicates the junction number; if it is a switch, its position is also given

Trigger

Choose one: trigger when crossed by car(s) as specified below; or disabled, do not trigger

When Crossed By:

Controls enabled if trigger is not disabled:

    Type Trigger type, as listed above
    Name Name or identifier or other required argument if any; see note below
    Direction Choose one: E-W, W-E, or Any.  Choices change to N-S, S-N depending on tracks at junction
Take Action Action script, an editable text box.
Or Actions: Other actions defined at the same junction:
    Arrows  Move through list; dimmed if only one entry
    Add  Create a new action at the end of the list
    Delete  Delete the current action from the list.  If there is only one action, this removes it from the junction.
Buttons Apply: update actions on layout (not saved permanently until layout save); OK: apply and dismiss; Cancel: dismiss without saving -- changes to Done after any save

Note:  The choices offered in the Name drop-down are limited to cars and trains currently sitting on the layout.  You cannot assign a trigger to a car or aar type which is not present.  This is a limitation we may remove in future versions.

On clicking OK, if you have created a new action at a junction, it is displayed with a Junction Action indicator (as long as edit or track tool is active):