Jump to content

Counting an event


Empfohlene Beiträge

Hello, I just made this in V6, please study this. You may always ask extra information how this is done..  
Kind regards, Herman

count problem in V6.mbp

Attention In V6 you have to program a signal to work. That is not explained here, we can help with that, but it is another thing. ( before a red signal trains do not stop in V6, exept when it  is done by EV ) If possible take the step to V7 or V8 where signal handling is effective done by the 3MBStudio.

Bearbeitet von Herman
extra info signal V6
Link zu diesem Kommentar
Auf anderen Seiten teilen

Herman and streit_ross both beat me to it  (y)

 

Still, here's my example:    counter variable example.mbp

When the signal is set to "clear", I set an object variable with the name "counter" to a value of 3
This object variable is stored in the signal. But any variable - object or module - will do the trick.

Upon leaving the contact, I reduce the value in that variable by 1

1218956586_counter1.jpg.b648d2783049c63491a8ed255c9bc8c1.jpg

 

and every time the variable changes, I

  • write it's value into a text field 
  • check if the value is 0 or less
  • and change the state of the signal to "stop" if that's the case.
    The two second delay before the signal change is for beauty only and not required

1238135385_counter2.jpg.6f89cd3bc86cc3fd7de9aa06d10be9ac.jpg

Kind regards
Goetz

 

Bearbeitet von Goetz
spelling
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...