New UnloadAll Driver Command

ffccnn

New member
Because of my signature "I don't drive trainz; I hire drivers", my route required a driver command to try to unload a train completely. The UnloadAll command works as the build-in Unload command. However, this new command repeats the unload process a number of times and waits some time between each unload.

UnloadAll<kuid:478639:1059>

When you select this command either in Surveyor or Driver, the command displays a submenu of five repeat options, where each option specifies a number of times to repeat the unload. The default values are 1, 2, 3, 5, and 8. Then for each of these repeat options it displays another submenu with 10 delay options where each delay option specifies the number of seconds to wait between unloads.

For example, in the config file there is a tag 'unload_2_label' that says in plain English "Unload 3 times" and a corresponding tag 'unload_2_val' that specifies the number "3".

In this way, if you decide to change the default labels and values, just change the values of the tags to whatever sentence and numeric value of your preference. The default numeric values are in ascending order but that is not required.

Similarly, a delay option has a tag label like this 'delay_3_label' to display the sentence "Wait 40 seconds" and a tag value 'delay_3_val' that specifies a numeric value of "40". Again, the default values are in ascending order but that is not required (but it looks better).

The numeric values of the delay must represent a number of seconds. For example if you decide to wait 1 year between unloads you would specify a tag value of 86400 and the label could be "Wait 1 year" or "Wait 12 months" or even, "Wait 86400 seconds".

I hope you will find this command of some use.

Cheers,
FFCCNN
 
A picture is here:

http://img265.imageshack.us/img265/2431/ffccnn201005080005.jpg

The delay between unloads was implemented using the WaitFor build-in command. You would see an entry in the kuid-table for it. If you do not have yet the WaitFor command you may want to download it from the DLS.

Also remember to select the UnloadAll command in Surveyor, main menu Edit Session -> Driver Commands.

I suggest to have a short return path to the target industry. You do not want your train to go to the other side of the map just to return to the industry. During my testing , I saw the train going around the short path or just reversing into the industry. In either case, it works as expected.

I did not plan to use this command to unload passengers. It may work, why not? anyways, I won't use it on passanger trains.

If your train has a mixture of different products of which none is accepted in the industry, you may see your train trying to unload over and over unsuccessfully until the number of repeats is exhausted. Then the train will leave to continue with whatever the schedule contains. I did not bother to count the amount of each different product, I just check for the total of products like "apples + pears". If the train has no product for the industry then the question is why the train is at the industry in the first place?

The UnloadAll command will re-do the driver's schedule by issuing a GoTo command to the target industry followed by a WaitFor command and the UnloadALL command next. Once the train is empty or the number of repeats is exhausted all traces of the WaitFor command will be deleted.

All logging messages has been commented out in the script. If you see a problem and want to trace it, you may want to uncomment those lines or just please post your situation here to the forum.
 
Back
Top