Jump to content

Sample layout with object variables


Recommended Posts


I'm happy to present here a layout (not too complex) where I've tried to limit the number of different events.  And the objective is to use this approach for bigger layout without the need to add new events.

The events cover the following goals :

1. Decide and pilot a train at the entry of a station : this will be executed in a section called "Decision" and the event, depending on a predefined itinerary defined as the 
   "object.variable" trajet into the object of the engine. 
   The decision that has to be taken is :
     - to which next section must the train go?
     - Which are the switches necessary to conduct te train to the correct next section and how must those switches be positonned.

   To solve this, the following events are necessary :
     - Decision for next section : 1 for each itinerary
     - Set switch for all : 1 event per switch
     - Toggle switch for all : 1 event per switch

2.  Decision on station : here, the itinerary is not relevant as, normally, each train will go to a next COMMON section.  So, the only think to do is to position correctly all switches.
     The following event are necessary ;
     - Prepare exit from station
     - Reservation of next switches and section
     - Stop at station
     - Toggle switch at exit : 1 per needed switch

3.  Decision for sections used to link 2 stations : here, also, the itinerarry is not relevant as there is only one next section.
     The following event are needed :

     - Toggle next for common : check if next section is free
     - Stop if next section is not free
     - Exit if next section is free

4.  Actions to take at entry of a section : maily freed the former section and former switches, if any
     - Free former switches and section

Is this perfect?  No, of course as all options aren't yet covered, like train entering a station by both side.  This will be the next problem to solve.  I also add event to force all trains to go back to predefined tracks used as the "garage"  These events reset the variables and stop the trains.  It will occur when the switch is toggled to "STOP".  To start, just push the switch to "GO".

Please let me know your comments and remarks and also how to improve this model.

I thank you all in advance



test trigger 9.mbp

Link to comment
Share on other sites

Hello André,

please take into account, that the variables "_Trigger1" and "_Trigger2" do no longer exist with Train Studio V5. Indeed, V4 layouts will be automatically converted for correct running with V5. Instead of the old Variables "_Trigger1" and "_Trigger2", each object, which causes an event, can be referred as "Trigger". With the possibility to refer nearly each object from another object by an object variable, you have many opportunities to create "common" event definitions for different event triggers. THerefore, it may be senseful to wait for V5 (beta version around mid of this month) instead of creating new event definitions with "_Trigger1" and "_Trigger2" values.

After the new version is available, you willl find an example layout in the online catalog ("MBS V5 Demo-Anlage 20190604"), where different "common" event definition are realized to run a train from one station to the next one, serializing itself with other rivalling trains and selecting and reserving automatically a free track in the target station before starting and blocking the free route there. Unfortunately the whole description is in German. I hope that doesn't matter.

Many greetings

Link to comment
Share on other sites

vor 13 Stunden schrieb BahnLand:

Unfortunately the whole description is in German. I hope that doesn't matter

Hello BahnLand,

I didn't know that Trigger1 & 2 will disapear in the next version.  Sh...:o.  However, I'm waiting this version for a certain time and, yes, it is a problem for me as I don't read German.  Is it possible today for you to send me that description so that I can translate it in english and french and send to you the results so that one can include it into the demo layout?

Thank you


Link to comment
Share on other sites

Hello André,

the file extraction for the event definition from a specific layout is still under construction by @Neo and therefore not yet available. So, I currently cannot provide you an extracted description of the event definition assigned to the layout "MBS V5 Demo-Anlage 20190604". After the file extraction will be available for V5 (maybe with the beta version of V5), I must at first write a new event evaluator as realized here for V4. But currently I don't know, to which format the file extraction will be done, and therefore, what I have to implement to get a readable convertion of the layout-specific event definition.

Many greetings


Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...