A little help with triggers please...

Hello all: I have read the tutorials ( I searched this forum and googled) & the Trainz manual, but still can't get my mind straight about using triggers for path control. I setup a one board test route using one siding and a main. I installed 2 basic industry objects. One supplies coal, located on the main track and the other consumes coal, located on the siding. I have 2 consists delivering coal. All I want to do is control the path of train 2 if train 1 is in the industry siding unloading coal.
When the siding is occupied by either train, I would like the other train to take the main track (or an alternate track) and wait until the industry siding is unoccupied then continue with its delivery.
If anyone can point me to a COMPREHENSIVE tutorial in ENGLISH, I would appreciate it.
Thanks, Durff
PS: I am using '04 but I assume '06 is the same.
 
Last edited:
Triggers are mainly used in GameScript scenarios. When a train enters a trigger, a section of coding can be performed.

To control trains in Driver sessions, add Trackmarks and then create driver commands to tell trains to drive to each of the Trackmarks on their route in turn. You'll need to create a Trackmark to control each part of each journey. You can also use Track Direction Markers to make a section of track "one-way".

The beauty of using Trackmarks is that the route for each train can be specified, even if trains share some track sections with other trains and then deviate at some point. Track Direction Markers apply to all trains.

If you haven't already done so, create a little test layout and experiment.

Try the tutorials on Chuck Brite's Midwest Central web site. They're excellent IMHO with regard to laying track and signalling but I'm not sure if they cover trackmarks in detail.

HTH, John
 
more info...

John: Thanks for your reply. I understand about track marks. I am not trying to get trains to drive specific routes unless the industry / siding they are trying to access is occupied. This happens often when, say, two coal trains are delivering to the same powerstation. In this case, I think triggers are the only way to go. If I use trackmarks and issue a "drive via" command, that train
would never enter the industry and unload.
If there is another way to do this please let me know.

Case in point; if train 1 was unloading and across a trigger, I would want the path of train 2 to be diverted until train 1 was no longer blocking the path. After train 1 has moved on, then train 2 could continue. This is exactly the case when you have a single track to/from coal mine and a double track or at least a passing siding at or near the coal consuming industry. In prototypical operations, the dispatcher would issue the "hold" order to the lower priority train. I.E.; "hold main track until train X engine XXXX passes" or " enter siding and wait until train X with engine XXXX passes"
It seems as though the triggers and rules when used properly are designed to do just that. The manual, however, is lacking.
Thanks
 
Last edited:
Try WaitForTrigger by Marinus.

What that does is causes a train to wait until a different train passes a trigger, then continues the schedule.

I know it isn't exactly what you are looking for, but I'm sure you could adapt.
 
For your described task I guess this might be the solution - more complex, you will need to work on that:

Demo-Maneuvering - KUID: 131986:241368 by atilabarut.
Download the whole package with new commands:
A short session to demonstrate the new junction and track control commands, ControlJunction, FreeJunction, ControlTrackAtTrackMark, and ReleaseTrackAtTrackMark. These commands along with other driving commands provide easy maneuvering/shunting.

It helped me a lot - and I understood only half ...

jost62
 
Triggers

Hi hotboxdetector,

What I would do in a similar stuation is, have your second train drive to a trackmark on a siding or passing loop and tell the driver to wait for a trigger which will be activated when the first train has loaded and cleared the line. A trigger is like it says, it will not continue to give instructions while a train is sitting on it, it only gives one instruction.

Hope this helps.
Bill69

PS. Glad my tut helped you jost62.
 
Last edited:
Hi hotboxdetector,

What I would do in a similar stuation is, have your second train drive to a trackmark on a siding or passing loop and tell the driver to wait for a trigger which will be activated when the first train has loaded and cleared the line. A trigger is like it says, it will not continue to give instructions while a train is sitting on it, it only gives one instruction.

Hope this helps.
Bill69

PS. Glad my tut helped you jost62.

problem going this way is if there is no train already at the destination point there will be nothing to activate the Trigger so your second train woulld just sit there waiting for another unit to arrive and depart before it would continue it would not enter the line eaven if it was clear, I have had this problem many times, and at the moment have not completely solved it

what we need is an ( IF/ELSE comand) !! HINT HINT


 
Triggers

Hi Kelly88,

If/Else??? I havn't used that sort of command since the 1960s & 70s when I was programing in Basic. However some sort of variable command would be very usefull I aggree.

Bill69
 
Hi Kelly88,

If/Else??? I havn't used that sort of command since the 1960s & 70s when I was programing in Basic. However some sort of variable command would be very usefull I aggree.

Bill69

Me Too
But it was the quickest/shortest way to express the function
but then all prog.variants have a way of doing the same thing

Cobol/Pascal/assembler and to some extent C++ and of corse Basic I know, but I have never realy looked a the Jet engine used by Auran !!



 
&Kelly88: ControlTrackAtTrackMark by atilabarut (see above) does this: IF the trackmark is occupied, THEN the checking train waits, IF it is free, THEN the train goes.
The demo I refered to above is a bit confusing as it contains unnecessary elements: texture, scenery, a unnecessary second rail. I deleted them all, that made observing the maneuvering easier.

& Bill69 OT: yea, BASIC and the Commodore64 ... and the petticoats - things to dream about ... Back to topic: it seems that ControlTrackAtTrackMark continues to give instruction UNTIL the respective trackmark is free.
 
Triggers Etc.

Hi jost62,

Well I never had a commodore 64. I started of with a TRS80 doing scoring and sorting programs for gymnastics and for yachting etc.

Hi kelly88,
I havn't looked at jet either and don't feel inclined to do so now. Too old!

Cheers,
Bill69
 
Last edited:
Hi jost62,

Well I never had a commodore 64. I started of with a TRS80 doing scoring and sorting programs for gymnastics and for yachting etc.

Hi kelly88,
I havn't looked at jet either and don't feel inclined to do so now. Too old!

Cheers,
Bill69

We must be around the same age (62 for me)
I started with a Superboard then a Nascome System
I then bought a TRS80 Model 3
Upgraded it to max ram , fitted 2 Floppy Drives 5.5inch
cost 2 arms and a leg (around 6 months wages at the time )
Still have it along With Visicalc, and the Wordprossesor from Tandy, and it still works

after that I had an Amstram 286 > 386 > 486

since then it was IBM compats ( all home built )

those were the days, these modern guys dont know what they missed, just looked up some old mags
1976 1MB Ram ( not these sims but IC's with many legs)
1'000'000 doller USA :eek:


 
GameScript is the programming language in which TRS2004 scenarios are written. I think it's probably also the language in which TRS2004 and TRS2006 Driver commands etc are written when their authors create them.

The fundamental programming language commands and constructs in GameScript are very similar to those of many other programming languages. GameScript closely resembles "C" but with a bit of research anyone familiar with BASIC won't have too many problems in that respect.

IMHO the real difficulties start, as they do with Visual BASIC, with all the objects and their multitude of properties, events and methods, each of which needs to be both understood and remembered. The situation isn't helped by the GameScript documentation only really acting as a reference guide for anyone who already understands it all. No disrespect is intended to the documentation authors by that remark - it's vastly more useful than having no documentation!

Things get really tough when what you write doesn't work properly, for example AI trains passing red signals. Debugging that kind of problem can take a long, long time.

Sorry for the waffle!

John
 
Thats all very well but it has to inter react with all the other scripts that are running at the same time,

anyway what I realy have problem with is as follows

If you have say 2 units running the same line ( direction )
And there are 2 platforms at the station it can use
and due to the delays caused by other actions along the route
there could be a unit already on 1 of the platforms
In wich case it would be nice to be able to give a command so that the unit could chose by its self wich platform to take

kind of like

DRIVE TO STATION XXX (PLATFORM 1 OR 2 )
LOAD
DRIVE TO STATION YYY (PLATFORM 1 OR 2)
LOAD

so the unit will go to plat 1 if it is free , or plat 2 if 1 is ocupied

at the moment if directed to a platform thats ocupied there is no way to know what it will do, and it will react different each time

1 it will just sit outside the station and wait till its free ( this is not so bad)
2 it will go through on the other platform and then try to back up
this then blocks the other unit from leaving the normal way so its just as likly to back out and try the other way itself, and then you get the 2 units shunting back and forth until one or both give up and just sit there forever
3 it will go in reverse and back down the line trying to find another way to go to get to plat 1
 
You guys are really dating yourselves

Yes, that's what Im looking for the IF/THEN type of logic. It seems as though the Demo-Maneuvering - KUID: 131986:241368 by atilabarut may do the trick. Unfortunately the DLS is still down. As soon as possible, I will DL that rule and try it.

PS: At least we don't have to use all those 1s and 0s anymore :eek:
and I haven't pulled any bugs out of the relay contacts on my PC lately !
Durff
 
I think "controljunction" may help: When train A has reached his "loading"-command, let him control the junction behind him in the other direction. That should help.
 
Sessions and rules guide 06

I had started this thread concerning rule use in '04. After poking around a bit, I found the '06, "Sessions & rules guide". There is mentioned an upcoming "Script & API reference" but I don't seem to find it. Would that be in the CCG? :confused:
 
Last edited:
I think "controljunction" may help: When train A has reached his "loading"-command, let him control the junction behind him in the other direction. That should help.

Well that should work, I have any way release junctions running, so if the line is set first to plat2 and the first train goes to plat1 then after he passes the junction it will automaticly change back to its plat2 setting, but this is not the problem, I need a command that you can give so that the AI can choose plat1 or plat2 depending which one is free, and if both are free defalts to plat1.

 
Back
Top