raf.sonneville Posted June 20 Share Posted June 20 Hi Who can help me with either commands or LUA script I have two trains running "Loc1" and "Loc2", and each train has two keywords: LOC1 = keyword "Module1" which refers to an user-defined event called "Loc1OpenDoors" second keyword "Module2" which refers to an user-defined event called "Loc1CloseDoors" LOC1 = keyword "Module1" which refers to an user-defined event called "Loc2OpenDoors" second keyword "Module2" which refers to an user-defined event called "Loc2CloseDoors" Now I want that when a trains hits a track contact the train stops and its corresponding event "Loc1OpenDoors" or "Loc2OpenDoors" is called, and when the train leaves the contact, the corresponding event "Loc1CloseDoors" or "Loc2CloseDoors" is called. I know that you can set this with a command that when a train hits a contact according to the trains name you can run its according event, but if you have 20 trains running then you have to do that for each train. Lot of work, lot of commands, which slows down the program. Thanks in advance for the help. Raf Link to post Share on other sites
Goetz Posted June 20 Share Posted June 20 Hello @raf.sonneville, according to your description, both trains have two keywords, "Module1" and "Module2"? Why? I'm going to bang together a little demo layout for you. Gimme a moment, please ... greets Goetz Link to post Share on other sites
Goetz Posted June 20 Share Posted June 20 Hello Raf, here is what I would suggest you should do: store the apropriate door names in each waggon. upon entering the station halt, go through all waggons in your train, check if a door name exists and animate that door wait some time with a second loop, close all doors again (because surely you don't want to close the doors after leaving the station?) set the train in motion (when appropriate) my demo layout: door opener.mbp Kind regards Goetz Link to post Share on other sites
raf.sonneville Posted Tuesday at 08:29 AM Author Share Posted Tuesday at 08:29 AM Hi Goetz Thanks for the effort, but thats what im doing now. I check if for instance Loco1 hits a track contact and then open and close its according doors. But i have a layout with over 30 trains (all self created belgian trains with ketchup) and i have to do that for every train hitting that rail contact. This means a lot of commands. What i want is that with one command it works for all trains using keywords to execute their according opening and closing procedures. Thanks a lot. Link to post Share on other sites
Goetz Posted Tuesday at 09:09 AM Share Posted Tuesday at 09:09 AM (edited) vor 58 Minuten schrieb raf.sonneville: This means a lot of commands. No, it doesn't. In my example, I use one command for all three trains. And I could use the same command for as many trains as you like. Keywords don't help in this context. Use object variables to have every train carry it's individual door names. Wanna check my example again, maybe? In fact, did you even bother to look at the example layout? Edited Tuesday at 09:28 AM by Goetz spelling mistakes fixed Link to post Share on other sites
raf.sonneville Posted Tuesday at 10:53 AM Author Share Posted Tuesday at 10:53 AM (edited) Hi Im at work till 2pm. I will look when at home. Do i load that example in 3DTS? Edited Tuesday at 10:53 AM by raf.sonneville Link to post Share on other sites
raf.sonneville Posted Tuesday at 11:06 AM Author Share Posted Tuesday at 11:06 AM (edited) Can u send this as pdf file pls? I tried at work to open this file but cannot open it with any program. Thx Edited Tuesday at 11:22 AM by raf.sonneville Link to post Share on other sites
Goetz Posted Tuesday at 11:52 AM Share Posted Tuesday at 11:52 AM vor 52 Minuten schrieb raf.sonneville: Do i load that example in 3DTS? Yes!!! It's a layout, exported into a file. You may either double click it after downloading. Or start the train studio first, go to "Online catalog" on the start page and look for "import existing layout" at the bottom right of that screen. Click on that and navigate to the downloaded file to open it. vor 41 Minuten schrieb raf.sonneville: Can u send this as pdf file pls? A layout as a pdf file? Are you having me on, Raf? Or do you maybe misunderstand the term layout? Just in case, here's a picture of it: Goetz Link to post Share on other sites
raf.sonneville Posted Tuesday at 02:20 PM Author Share Posted Tuesday at 02:20 PM Sorry ... i thought it was a sort of text file of the commands in your layout. I saw your layout.... still have to search out how it all works, but I will find it. Thanks a lot for this. Regards Link to post Share on other sites
raf.sonneville Posted Tuesday at 04:25 PM Author Share Posted Tuesday at 04:25 PM Hi Goetz Sorry to disturb you again I tried your layout and works fine. Then i tried this on my layout with nearly 30 trains and it works wonderful. Whatever train that stops at a signal the doors open.... however... The doors don't close when th train leaves, and the reason is that I am using automated routes, the trains stop at a signal and stand therewaiting until the signal is turned green by the automated routes. This means that the command "For all vehicles on a track/contact" does not work because I cannot not use a trigger there. If a put this command within the command for a signal changing to green then I cannot select at" Vehicle" on the right the trigger option, so the train leaves when the signal goes green but the doors don't close. Can you once more help me on this please. Thanks so much Regards Link to post Share on other sites
HaNNoveraNer Posted Tuesday at 04:57 PM Share Posted Tuesday at 04:57 PM If you will use "signal with keyword changes to green" you have to store the train in a variable in the signal to access the train. Maybe you could also use "route is activated" then store the train in the route. You must use "for all vehicles in a train" instead of "on a track" then. Regards Thomas Link to post Share on other sites
Goetz Posted Tuesday at 05:01 PM Share Posted Tuesday at 05:01 PM Hello Raf, vor 29 Minuten schrieb raf.sonneville: The doors don't close when th train leaves Have you ever seen a train, where doors close when it leaves a station? They should be closed before the train is set in motion, don't you aggree? You have some mechanism which changes the signal and sets the train in motion, correct? That's where you should insert some method to close the doors, wait the appropriate time and then send your train on it's journey afterwards. Without knowing how your current mechanism works. I find it difficult to give you some appropriate advice. Kind regards Goetz Link to post Share on other sites
raf.sonneville Posted Tuesday at 05:08 PM Author Share Posted Tuesday at 05:08 PM You are right, in real life the doors close before leaving. In 3DTS the train leaves when the signal turns green, and speed is set by the settings of the signal, "accelerate to". I think all i can do is leave the doors open for some time, then close them, and then let the train wait with closed doors until the signal turns green. Anyway, thanks a lot for all your help. Regards Link to post Share on other sites
raf.sonneville Posted Tuesday at 05:11 PM Author Share Posted Tuesday at 05:11 PM 12 minutes ago, HaNNoveraNer said: If you will use "signal with keyword changes to green" you have to store the train in a variable in the signal to access the train. Maybe you could also use "route is activated" then store the train in the route. You must use "for all vehicles in a train" instead of "on a track" then. Regards Thomas Thanks for the help, i will try that. Link to post Share on other sites
Goetz Posted Tuesday at 05:49 PM Share Posted Tuesday at 05:49 PM vor 35 Minuten schrieb raf.sonneville: In 3DTS the train leaves when the signal turns green, and speed is set by the settings of the signal, "accelerate to". Still, you can use the mechanism which turns your signal to "clear" to first close all doors and then, with a delay of a few seconds, change the signal state. Or, if you want a more natural behaviour and don't mind a bit of extra effort, deactivate the acceleration in the signal contact close the doors when the signal changes to "clear", indicating that the path is clear and secure wait a few seconds activate the accelleration in the signal contact wait another second deactivate the acceleration again (because it's no longer needed for this train which is already moving and you want it off again for the next one that follows.) Link to post Share on other sites
simonjackson1964 Posted Tuesday at 08:03 PM Share Posted Tuesday at 08:03 PM Just for my 2p worth here, another option is to stop the train at the platform short of the signal, open the doors, wait, then check if the signal is green. If it is, close the doors, and set the train moving. If it isn't then you leave the train at the platform and have the signal changing trigger the event that closes the doors and starts the train. Of course that does mean that when the signal changes you have to check to see if the train's delay is still running but that's just putting a boolean on the loco or the signal, or even on the platform! Link to post Share on other sites
raf.sonneville Posted Wednesday at 03:38 PM Author Share Posted Wednesday at 03:38 PM Hi guys Thanks for all the help from all of you ... I found the way .... works PERFECT now. Thanks Regards Raf Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now