Jump to content

Recommended Posts

Posted

Hi all,

Using V6. Could anyone let me know, how to create an event which triggers when something else happened 3 times. (For example, signal turns red when train completed 3 laps on the layout.)

Posted (edited)

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.

Edited by Herman
extra info signal V6
Posted (edited)

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

 

Edited by Goetz
spelling

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...