Jump to content

EV - Add "ALL" and/or Same Name Conditions.


trevor

Empfohlene Beiträge

I find myself duplicating whole groups of code in the event handler with the only difference between each group being the initial entry condition of all the events within. The remainder of the conditions and actions make use of the Triggers and pointers defined in the originating objects variables.. This of course makes it a horrible task if I need to make a small change to the logic since I have to properly replicate the change to 10s or maybe even hundreds of groups.

To rectify that, it would greatly simplify matters if you could change the EV to do the following.

1. Add ANY or ALL to EVERY event condition. You already have "All Locomotives"  in the train enters track, but there is no "All Tracks" state. We have the conditions statements to refine the event, and with the addition of the _Triggers, that includes filtering the name if need be.

2. As possibly a better alternative, if I use the "User Defined" choice and enter say the name "Train_Enable" the event should toggle for ANY OBJECT with that name. That way I can have common controls for all trains on the board with variables set in each to properly point at the objects under control rather than having different event code for each.

Actually the more I think about it.. both features would be a nice addition.

 


Here is a typical example....

On my layout I have numerous small tracks called "Section_Entry_(Number)".
The EV detects a train entering and leaving that section and sets a SECTION object state appropriately.
Currently I need an EV entry for every single one of them.....
The EV statements are ALL identical (or should be) bar the entry condition itself.

It would be so much simpler if...

1. I had a global Train enters track - Any Train - Any Track event
2. I added a variable to the track sections to identify their type... e.g. Type = "Section_Entry"
3. I added a second variable to the track section to reference the section itself, e.g. Section = "Section_12"
4. I made a single event handler that checked for the type and then performed the appropriate actions on the referenced section.

Similarly, this example would ALSO work if I gave ALL those track sections the same name and the User_Defined setting acted on all objects with that name. Though having lots of objects with the same name does present other issues.

NOTE I SAID EVERY OBJECT EVENT... The same issue exists with track switches, controllers et.al. The only one I can currently think of that does not merit an ALL selection is "variable has changed" since variables do not have sub-variables. Though someone might argue the use of the variable pointing at an object that does might merit the addition.

 

Trevor

Bearbeitet von trevor
addition
Link zu diesem Kommentar
Auf anderen Seiten teilen

Erstelle ein Benutzerkonto oder melde dich an, um zu kommentieren

Du musst ein Benutzerkonto besitzen, um einen Kommentar verfassen zu können

Benutzerkonto erstellen

Neues Benutzerkonto für unsere Community erstellen.

Neues Benutzerkonto erstellen

Anmelden

Du hast bereits ein Benutzerkonto? Melde dich hier an.

Jetzt anmelden
×
×
  • Neu erstellen...