PDA

View Full Version : A little help with triggers please...



Hot_Box_Detector
February 3rd, 2007, 01:52 PM
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.

john259
February 3rd, 2007, 03:17 PM
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 (http://trains.0catch.com/tutorial.html). They're excellent IMHO with regard to laying track and signalling but I'm not sure if they cover trackmarks in detail.

HTH, John

Hot_Box_Detector
February 3rd, 2007, 04:37 PM
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

BidMod
February 3rd, 2007, 04:46 PM
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.

Hot_Box_Detector
February 3rd, 2007, 04:55 PM
BidMod: Thanks I'll try that...

jost62
February 3rd, 2007, 06:41 PM
That tut helped me:
http://www.pixieplots.co.nz/bill/My_Homepage_Files/Page3.html

jost62
February 3rd, 2007, 06:57 PM
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 (http://www.auran.com/TRS2004/DLS_viewasset.php?AssetID=66870#).
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

Bill69
February 3rd, 2007, 08:59 PM
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.

Kelly88
February 4th, 2007, 03:06 AM
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

Bill69
February 4th, 2007, 03:45 AM
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

Kelly88
February 4th, 2007, 04:12 AM
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 !!

jost62
February 4th, 2007, 04:27 AM
&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.

Bill69
February 4th, 2007, 04:35 AM
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

Kelly88
February 4th, 2007, 08:50 AM
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:

john259
February 4th, 2007, 09:40 AM
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

Kelly88
February 4th, 2007, 11:16 AM
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

Hot_Box_Detector
February 4th, 2007, 12:34 PM
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 (http://www.auran.com/TRS2004/DLS_viewasset.php?AssetID=66870#) 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

jost62
February 4th, 2007, 02:12 PM
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.

Hot_Box_Detector
February 5th, 2007, 12:14 AM
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:

Kelly88
February 5th, 2007, 04:27 AM
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.

Bill69
February 5th, 2007, 05:55 AM
Hi all,

Just got back from a days fishing.
Kelly88, I know what you mean but I don't use different platforms for trains in through stations. I have two main layouts that I run regularly. One is setup with UK signaling and scenery and uses UK rollingstock. On this layout all trains are sent to the lefthand platform and if it is occupied I use a wait-until-not-red command, this stops the second train at the previous signal and stops the driver from taking a different route. My other layout is signaled for US trains and rolling stock, and they are always sent to the righthand platform if it is a two platform station, the same commands apply on this layout as well. So on the whole I need fewer commands to get the driver to do what I want him to do.

Cheers,
Bill69

Kelly88
February 5th, 2007, 08:53 AM
Hi Bill69

I also use the same thing on 2 plat stations, but I have several with 4 or 6 through plats, and 1 with 5 plats ( Terminal ), for an example DL my " Rhye on Sea " this is just a 1 board kind of model RR with a 4 plat station
1 & 3 on the up and 2 & 4 on the down, I did this during Xmas when our grandchild was here, he whanted to see the trains go round, so I took the plans from an old Model Railway Mag, I had 5 passanger units (Steam) running round it and to goods units that shunted under AI , the track is a double track twice around the board, with 2 small goods yards that run point to point, the goods had also to pass through the station to change yards, I put the layout up on the DLS, because there was some one else new to the flock was asking about this sort of layout, I never put the session up because it used a lot of engines and wagons I had repainted or changed the config, ( for my own use and without permission ).
The lad spent hours just sitting watching them go round ( he is five )

jost62
February 5th, 2007, 04:11 PM
@Kelly88: Now I understand your problem - I tried to make a trackplan as you described. No, at least to my knowledge there is no solution. It is indeed no problem that train A unloads at platform 1 and train B unloads at platform 2. But what you want in AI (when driving by hand it also would not be a problem) is: Train B go to trackmark1=platform 1. IF this is empty. IF NOT: Goto PLatform 2. Did I get it?
I think that can not be done. You only can tell a driver to go to ONE next trackmark. Perhaps our script- or rulemakers have an idea???!!!

My grandchild also joined me for hours at trainz during christmas vacation, building a own basebord, and spreading dozends of kangoroos over my black-forest-baseboard (also not sharable because of repaints and config-changes ...).

john259
February 6th, 2007, 02:35 AM
As a totally different approach to this problem, don't forget that TrainzProRoute's (http://www.trainzproroutes.org) excellent SCS (Scenario Creation System) is available for TRS2004 and TRS2006. Free painless registration is required to access their forum, then look for the SCS sections.

John

Kelly88
February 6th, 2007, 03:42 AM
As a totally different approach to this problem, don't forget that TrainzProRoute's (http://www.trainzproroutes.org/) excellent SCS (Scenario Creation System) is available for TRS2004 and TRS2006. Free painless registration is required to access their forum, then look for the SCS sections.

John

Yes I saw this and downloaded it and the instruction manual but it wont work for me , you need SP-1 (2.6) and Auran have told me by E-Mail that there will be no SP for my version (French) as the French distributers told them they prefer to have a complete new package, (TRS2007) this has been in the shops now for some time but I dont see why I should have to spend 70 again to get a serice pack that every one else gets free !!!!

45581fred
October 13th, 2012, 05:12 PM
Hi
Yes, this is rather late!
However, a working solution (that I've not seen anywhere) is to have a large radius track mark at the far end of a fan of loops (i.e. one track splits into two or more, then recombines back to one. followed by the trackmark) - suggested radius 150metres, or whatever stops your trains before they over-run the exits from other tracks. This is not totally random - AI picks the shortest available route first, but it works. I think in TS2009 and previous that you may have to either uncouple the engine, or temporarily remove the Trainz Driver, otherwise the AI logic assumes you are going to move (as it HAS to[?], otherwise how would mainlines work? Yet in TS2010 it works fine. (So far, at least . . . ). Maybe it does work in earlier versions with the driver on board / loco attached, but I've not seen that.