PDA

View Full Version : TANE: Special Instructions command



parsifal300
August 30th, 2016, 07:30 AM
Is the Special Instructions command compatible with T:ANE? I am attempting to use consist_length but regardless of the number of cars at the TM consist_length always gets set to 0.500000.

Thanks all!
~P

trev999
August 30th, 2016, 10:41 AM
Hi Slow - Thanks for pointing that out. Yes, it seems that SI: Measure Train doesn't work in TANE. I ran a test using consist_count and it returns a value of -2, meaning that the trackmark isn't found. (See line 145 of SpecialInstructionsScheduleCommand.gs).

SI was written chiefly to support Potteries Loop Line (See my banner) and works in TS12. I suspect that it doesn't like the % symbol in the trackmark name.

The percent is used as a filter to restrict the menu to just those trackmarks that are intended for measuring, so I'll see if I can get it to work with a unique alpha string instead. 0.5 is the rounding factor.

Best Regards - Trev999

trev999
August 30th, 2016, 12:00 PM
Update: TANE is blameless. The failure to operate correctly is due to faulty logic. It only happens under certain conditions.

The command searches in the direction of the trackmark arrow until it finds a train or the next object is more than 500 metres ahead. If the track runs out before 500 metres then it should try the other direction but the fault prevents that from happening. Turning the trackmark to face the other direction will allow the search to find the train.

As a temporary fix, open the file "SpecialInstructionsScheduleCommand.gs" and search for the text "no train found ahead".
Immediately above that line is a line that reads: if (dist > 500) {

Change that line to read: if (dist > 500 or iCount < 1) {

EDIT: Above line was wrong, corrected.

The command will then correctly record the train parameters in their respective session variables.

Best Regards - Trev999

parsifal300
August 30th, 2016, 01:55 PM
Thanks for the timely and detailed response.


Update: TANE is blameless. The failure to operate correctly is due to faulty logic. It only happens under certain conditions....

You mean it took 29 months to find the errant logic? Welcome to my world. In another life I was a SW test engineer, it still comes back to haunt me.


SI was written chiefly to support Potteries Loop Line ...

I've taken a look-see at your site. Looks great, I'd download it in a second if I didn't fear running into compatibility issues with T:ANE.


Hi Slow -

:o Thanks again.

trev999
August 30th, 2016, 03:05 PM
I've taken a look-see at your site. Looks great, I'd download it in a second if I didn't fear running into compatibility issues with T:ANE.

Your fears are well founded, Slow. PLL is not yet ready for TANE.

It's not my site, by the way; I am just one of the contributors. Thanks again for bring the error to my attention.

Best Regards - Trev999

trev999
August 31st, 2016, 02:01 AM
Hi Slow - As an afterthought, could you tell us what use you are making of the consist length, please?

There are some driver commands that can do conditional execution of the driver schedule.
Skip if session-variable <kuid:160293:101014> is a driver command that looks a specified variable and decides whether to continue executing the next command or to jump forwards to a label and continue from there. You can decide on one course of action or another, depending on the variable value.

Insert buff label <kuid:160293:101002> is used to define the point where the execution continues if a skip is performed.
Jump to label <kuid:160293:101003> is an unconditional jump, used when the first block ends and the second must be skipped.
Wait Until S-variable <kuid:160293:101006> holds up the driver schedule intil the specified variable meets the required conditions.
In order for menu options to be made visible in the "Skip if" and "Wait Until" command, entries must be made in the Input Table rule to define which variables and which comparison options are presented. Instructions are in the descriptions of the commands.

Hope this is of interest.

Trevor

trev999
August 31st, 2016, 06:26 AM
Elstoko has been checking up in me. He points out that I have made another mistake in the code. Please re-read post #3 and change the referenced line accordingly.

This once more proves the saying that I have coined: One mistake leads to another.

parsifal300
August 31st, 2016, 12:09 PM
My M.O. with trainz and the learning curve is switching between layout creation, AI control and asset creation. When one area of trainz gets long in the tooth, or I just get frustrated with "issues" I switch. Current area is on AI control and learning the best way to control particular aspects: rules or command lines. I was attempting to find a decent way to do if-then-else control, which can be challenging in the top-down general rule flow, when I discovered your variable control commands. From this I just searched DLS for scripts in which you were the author and I found the rest. Now I have a way to deal with conditionals via driver command. An added bonus is the command-line control which helps with the timing aspects of top-down rule execution; rules happen at the time the rule executes which can be tricky to coordinate with the timing of when a consist actually does something.

Current use for the Special Instructions->[calculate]length is managing a yard's consist inventory. I stock empties for redistribution while centralizing full inventory for hauls to portals. When a smallish consist comes into the yard with a load of full cars the loco needs to determine what siding can handle the incoming consist and what siding has empties to take back.

By the by, the Approach Target-> Couple Ahead or Stop at TM, and Approach Target->Couple Ahead and proceed to TM have saved me from all sorts of convoluted programing logic: Thanks.

Since we're on the subject, I have a couple of questions:
- Is there any reason why the "skip to label" and "jump to label" have 20 entries but the "Insert buff label" only allows 10? (And so far 10 has been ample.)
- The "Insert buff label" script information lists 2 associated commands I'm unable to locate: Skip when (trackmark vacant / occupied) and Insert green label. Do these exist?
This is more of a curiosity thing due to the fact I've found the majority of your other scripts helpful.

~Erik, and still slow.

trev999
August 31st, 2016, 03:15 PM
Hi Erik - Buff labels came before green labels. When a long sequence of driver commands uses buff labels the label numbers can be re-used because once a label has passed out of use then another label with the same number can serve as the target for another Skip instruction. Therefore, ten labels is usually more than enough. The Skip if session-variable command has been upgraded to display a choice of 20 labels. You can extend the range of the buff label if required, by editing the config file.

The green label has a bold green coloured icon so that it stands out and is easily recognized. It is used as a marker so that a particular spot in the schedule can be quickly located, and is typically used for debugging purposes. There are more numbers so that they can be used in many different schedules. Usually, green labels are not used as targets for skipping but they can be used if so desired.

If you send me an e-mail I can supply a couple of other 'Skip' commands and the green labels if you wish to have them. My e-mail address is in the config file of all my assets.

Using multiple Skip If driver commands works well, providing AND/OR capability. It just takes a bit more brain work to get the logic right, and that's where several differently numbered buff labels are needed. I've seen schedules with more than 100 commands in them.

There is a down side when skipping over a large number of commands: If a heavily loaded AI train is moving then it tends to slow down quite quickly because the throttle isn't maintained at the original level and falls to zero after a few seconds, especially on up grades, so these skip operations are best performed when the train is moving slowly or not at all.

Best Regards - Trevor

davidbird
September 8th, 2016, 07:15 AM
I'll wade in with another request, linked to this. Is there a RULE to get a consist length? I have a situation where a player-controlled train is picking up wagons from a set of power station exchange sidings. The power station shunter (incidentally an 0-4-0 steam engine in 1990!) assembles the trains in cuts of 7 wagons at a time. I need to chastise the player/driver if he picks up a train which is not fully ready.