Hi Everybody
I mentioned the value substitution in my previous posts. I explain what I mean in response MarkoP's posts about the cars in the train.
The "$Variable_name" means the value of the "Variable_name" now. This should continue to think about.
My idea:
For example the "{variable_name}" similarly behaves like "$Variable_name" but it can be anywhere in the expression. The "{variable_name}" replaced with the current value in expression text.
Loco.Car_count = 3
Loco.Car1 = Blau_3te_KL
Loco.Car2 = Blau_2te_KL
Loco.Car3 = Bayern
"$Loco.Car{Loco.Car_count}" means "Bayern" because "{Loco.Car_count}" replaced by its value "3" and "Loco.Car3" is "Bayern". In this way it would be possible to handle simple arrays.
Other example for usage nested substitution:
Loco.Max_speed = 320
To set train speed to reverse max. speed when "Loco" reaches the exit of the station (Actions only):
Set track vehicle speed
Locomotive: [Trigger 1: Locomotive]
Track: [All track]
Speed: -{{_Trigger1._Name}.Max_speed}
1st substitution: "{_Trigger1._Name}" replaced "Loco"
2nd substitution: "{Loco.Max_speed}" replaced "320"
The resulting expression is "-320" as used now.
I think this idea is useable
- to collect cars of the train if it will be "Car enters/leaves track" event.
- to point the car to detach it (if the cars are enumerated in an array)
- to select any device (track switch, signal etc.) by an alphanumeric index
Viele Grüße
kronauerl