Uploaded to the DLS: Directional Trigger Check Rule <KUID:532391:100003>
Several times when making sessions I have wished there was an easy way to set junctions via trigger, but differently depending on which way the train is going. For example, one way when the train is headed outbound, another way when it is returning to the yard on the same track.
Since I know absolutely nothing about scripting, I decided to extend the Trigger Check Rule to apply an additional test: to execute the child rules, the train must be proceeding through the trigger in the proper direction, i.e. in the same direction as the arrow of the trigger, if the trigger had an arrow.
Although it is not obvious from their icons in Surveyor, triggers do in fact have a "direction."
The Directional Trigger Check Rule operates exactly the same as the Trigger Check Rule, except that it only 'fires' if the train is going the right way.
There are two ways to tell which way the trigger is "pointing." The first way is to use the standard Surveyor trigger, which looks like a green cross. After placing it, you immediately place a track marker next to it. The trigger is pointing in the same direction as the track marker. If you want it pointing the other way, 'rotate' it just as you would a track marker. It will look the same, but it will be quietly pointing in the opposite direction. You can then delete the unneeded track marker.
The second way is to download and install boat's "Directional Trigger" <KUID:76656:70010>. It has the advantage of looking like a big green arrow, so you can tell immediately which way it is pointing.
The Directional Trigger Check Rule will work with either type of trigger.
I have tested this in TS2010 and TS12. Although it ought to work in other revisions, I have no way to verify that.
Note: Because of the way the Trigger Check rule operates, you have to be careful with the "Trigger Only Once" check box. A train going in the "wrong" direction will not cause the child rules to execute, but it will mark the trigger as used once.
Several times when making sessions I have wished there was an easy way to set junctions via trigger, but differently depending on which way the train is going. For example, one way when the train is headed outbound, another way when it is returning to the yard on the same track.
Since I know absolutely nothing about scripting, I decided to extend the Trigger Check Rule to apply an additional test: to execute the child rules, the train must be proceeding through the trigger in the proper direction, i.e. in the same direction as the arrow of the trigger, if the trigger had an arrow.
Although it is not obvious from their icons in Surveyor, triggers do in fact have a "direction."
The Directional Trigger Check Rule operates exactly the same as the Trigger Check Rule, except that it only 'fires' if the train is going the right way.
There are two ways to tell which way the trigger is "pointing." The first way is to use the standard Surveyor trigger, which looks like a green cross. After placing it, you immediately place a track marker next to it. The trigger is pointing in the same direction as the track marker. If you want it pointing the other way, 'rotate' it just as you would a track marker. It will look the same, but it will be quietly pointing in the opposite direction. You can then delete the unneeded track marker.
The second way is to download and install boat's "Directional Trigger" <KUID:76656:70010>. It has the advantage of looking like a big green arrow, so you can tell immediately which way it is pointing.
The Directional Trigger Check Rule will work with either type of trigger.
I have tested this in TS2010 and TS12. Although it ought to work in other revisions, I have no way to verify that.
Note: Because of the way the Trigger Check rule operates, you have to be careful with the "Trigger Only Once" check box. A train going in the "wrong" direction will not cause the child rules to execute, but it will mark the trigger as used once.