[Solved #11] Trigger and appending schedule tasks [Solution #13]

ek.skirl

Active member
Hello Trainz lovers,

My problem is to append a schedule task (list of driver commands) to a current schedule task of a train triggering a trigger. All trains triggering this trigger shell get a different task appended decided by the value of a variable.
My approach doesn't work well because the "Driver Schedule Rule" seems not to run as I expect it to. After testing this is in my eyes because this rule is to be assigned to a driver.
My planned session needs a schedule rule that is a kind of trigger with possibility to append driver command to the triggering train without knowing the driver on it. Is there any?

Greetings from Germany
Ekkehard

The planned session:
There is a portal (TrainGenerator PTG) and three portals (TrainDest_A PTDA, TrainDest_B PTDB, and TrainDest_C PTDC).
Near TG on the one track part are a trigger TR and a TrackmarkTM followed by two junctions JA to left side track to PTDA and JC to right side track to PTDC.
The portal TG generates every minute (randomly) a train from its list. The 1st, 4th, 7th, ... train shall get the schedule to navigate to PTDA. The 2nd, 5th, 8th, ... train shall get the schedule to navigate to PTDB. The other shall get the schedule to navigate to PTDC.
The Trains at the portals list get a driver and the task to "Drive viaTM".

/-------------PTDA

PTG-------TR---TM-----JA--JC----------PTDB

\---------PTDC


With help of session rules the trains current schedule shall be appended by the destination when reaching the trigger TR. The destination of the train will be decided by a variable DEST (1 -> PTDA, 2 -> PTDB, 3 -> PTDC) .

My current ruzle approach is principle running in its logic:

Thread-180201-%231.jpg

Picture Thread 180201 #1
 
Last edited:
The Append Schedule never worked properly even in earlier Trainz versions. Instead of using Append Schedule, use Insert Schedule instead to place your schedule you want to add.

As you probably found out, the Append Schedule scrambles the order of the driver commands and the AI drivers then act as though they're having a fraternity party.
 
The Append Schedule never worked properly
Ok. Is your "Append Schedule" rule the "Driver Schedule" rule I used? And a "Insert Schedule" rule I didn't find installed or on download station. What kuid it has?

Here is another approach I took last hours, but the "ScheduleOnTrackMark" never ends, even I set it to run only once. So the second rule in the ordered list never starts.

Thread-180201-%233.jpg

Picture Thread 180201 #3a

Picture Thread 180201 #3b
 
Last edited:
Ok. Is your "Append Schedule" rule the "Driver Schedule" rule I used? And a "Insert Schedule" rule I didn't find installed or on download station. What kuid it has?

Here is another approach I took last hours, but the "ScheduleOnTrackMark" never ends, even I set it to run only once. So the second rule in the ordered list never starts.

AD_4nXd6BK9d73-iVNHRPfuKB6ZE9jQaYVmR-baWbAUy3QqU_1kN2BBhJ3nDAiUHkU2vIopBnOSjvdQXBiqIQxi-XCz11z61XXvzbCr6_4f3AinTjJEGUpNPJFe0_Zi5Swrq47rbn4hF
This is part of the Schedule Library / Copy Commands From... When you use Copy Commands From... and you get the option to insert a schedule you then pick or append the rule. Here you use insert schedule only.

When I first used this many years ago, I found out the hard way after my drivers were going crazy on my route.
 
This is part of the Schedule Library / Copy Commands From...
Yes, that is. But this are Driver Commands. My Problem deals with Rules to append Driver Commands to an existing Driver Commands List.
Place a TM between the junction and the portals. Then use the schedule at TM rule for each TM.
This I tried in my second approach, but I don't know if the ScheduleAtTrackMark is really usable multiple times for the same TM but with different schedules.
Additionally I don't know if after running it once (setted before at running once of course) this rule really terminates the threads. In the rules list it doesn't and stayed running. So the following rule in the first ordered list never will run for second and following trains.
The three SchedulAtTrackmark Rules set for the same Trigger different Driver Command Lists.

Thread-180201-%236.jpg

Picture Thread 180201 #6
 
Last edited:
P.S. Is it possible that the ScheduleAtTrackMark rule doesn't fit the requirements by Trainz? In my eyes this rule is a "Does Not Support Children" rule and should only stay running in "all along session" mode or only until the setted count isn't reached. After that it should set its mode itself to "COMPLETE" (see wiki: Session Rule Implementation), but it doesn't do so.
 
I've never used the ScheduleAtTrackmark rule.

Have you tried using a Wait... command with a 20 second period? That sometimes helps with loading commands.

If that doesn't work, then it could be that it's not compatible with the current version of Trainz-Plus.
 
Hello again.
after much reading in forum threads I found some hints about fitting Driver Commands by @trev999 (see thread Insertion of a driver command by script of a Trackside asset into the schedule of a train under AI control [Post #16]). His beautifull Driver Commands in conjunction with the InputTable command by atilabarut are very usefull and I got a solution of my task.

<kuid2:131986:1012:1> InputTable
<kuid:160293:101002> Insert buff label
<kuid2:160293:101003:2> Jump to label
<kuid2:160293:101005:5> Set S-Variable
<kuid2:160293:101006:3> Wait Until S-variable V3
<kuid2:160293:101014:3> Skip if session-variable

The use is first a little bit confusing because until fitting entry in the InputTable Session Rule there is no response of some Driver Commands. Reading the descriptions of "Skip if session-variable" and "Set S-Variable" is there for very usefull.



@trev999 It would be nice to add a response to the silent commands. And is it possible to set an initial value to the S-Variables while adding it to the InputTable, so there is a defined state to the S-Variables?
 
Last edited:
And is it possible to set an initial value to the S-Variables while adding it to the InputTable, so there is a defined state to the S-Variables?
This isn't necessary, I found out. Using the Variable Modify Rule with the varible name from the InputTable at the highest rule level does it very well.
 
And finally here is my solution:
The route/session layout:

/-------------PTDA

PTG----------TM-----JA--JC----------PTDB

\---------PTDC


The session rules:

Thread-180201-%2313a.jpg

Picture Thread 180201 #13a

The InputTable:

Thread-180201-%2313b.jpg

Picture Thread 180201 #13b

The Trains at the generating portals list get a driver and the following driver command list:

Thread-180201-%2313c.jpg

Picture Thread 180201 #13c

The Driver Command List is as following:

Thread-180201-%2313d.jpg

Picture Thread 180201 #13d

"Drive viaTM" "Skip to label 1 if DEST>1" "Set DEST to 2" "Navigate to PTDA" "Jump to label 3" "Label 1" "Skip to label 2 if DEST>2" "Set DEST to 3" "Navigate to PTDB" "Jump to label 3" "Label 2" "Set DEST to 1" "Navigate to PTDC" "Label 3"

Thats it.
 
Last edited:
Back
Top