Difficulty with Variables in Scenario

jcardana

Trainz Enthusiast
Difficulty with Variables in Scenario [SOLVED]

[SOLVED]
I'm 99% sure this is an operator error but I'm so frustrated I bought another 2 pack of cigs.

GOAL: I want to increase points while the loco is moving and not increase points while it's stopped.

I have the Custom HUD displayed so I can see the variable "running"

I'm using two "Wait on Train Start/Stop" rules. 1st rule is setup to assign a 1 to the variable "running" when the loco is moving. The 2nd is setup to assign 0 (zero) to "running" when the loco stops. Both are setup to watch for a specific train... "MOW crane truck BNSF 1".

When I start and stop the loco, the variable display in the HUD correctly shows "running" changing from 0 to 1 and back again.

My problem is with the Variable Check rule. I have it in the Root position, under the two "Wait on Train" rules. It's setup to check if "running" is equal to 1 and evaluate the condition every second.

Indented under that is Variable Modify Continuous which is setup to add 1 to "ranking_points" every 1 seconds.

When I start the loco, the points increase. When I stop the loco, the points CONTINUE to increase. I also had a Check Variable to look for "running" to be equal to 0 and add 0 (zero) points to "ranking_points". That didn't work either.


I hope I explained this well enough, I'm at my wits end
Thank you
Joe
 
Last edited:
I have partially reproduced this in Trainz Plus (I no longer have TRS19 "standard" and my copy of TRS19 PE was unexpectedly converted to Plus when I upgraded - damn) without getting even to first base. The Display Custom HUD rule is showing as "obsolete" and I cannot get it to display more than one variable at a time. So I skipped keeping track of the "running" variable and just displayed the "ranking-points" variable by itself.

The problem that I see is that you are using the "Variable Modify Continuous" rule which never terminates so it will always be running and adding points to the score, regardless of what the loco is doing.

I will have a look at another solution. We have just gone into a hard 1 week (minimum) covid lockdown here. This was after a two week "phony lockdown" where nothing seemed to be actually "locked down" and, predictably, it did not work. So I now have the free time to look at these things.

Peter
 
Last edited:
I have created a solution that works in Trainz Plus.

Score-Keeping-Solution.png


The "Wait on Train Stop/Start" rules only need to be triggered once because the Reset rule will restart them again each time through its loop.

Hope this works in TRS19.
 
Thanks, I'll give this a shot later when I put the wife to bed. I tried using the "Variable Modify", but not in a Rest List. :)
 
Back
Top