Jump to content

Help with programming an event


Empfohlene Beiträge

I am trying to store a variable (Current speed) read from a certain train.

I want to read the current speed of the locomotive at all times and then store it as a variable and check

to see if the current speed is not 0.

If it is not, I plan to trigger a series of events.

Unfortunately I am still on V6.   

I can read the speed, but not check to see if it is zero.

Regards

Curtis

Link zu diesem Kommentar
Auf anderen Seiten teilen

vor 25 Minuten schrieb Curt84328:

I want to read the current speed [...] and check to see if the current speed is not 0

Hello Curtis,
This is not what you asked for. And Bahnland gave you the appropriate answer. But still ...

Would it help you to know that a train which stops can trigger a dedicated event?

597371151_triggereventtrainstops.jpg.c03e03121d228886121b7884061b5b9b.jpg

Greets
Goetz

Link zu diesem Kommentar
Auf anderen Seiten teilen

Hi Curtis,

Bahnland's suggestion is not working because the event is not triggered. A user-defined event needs a call. For instance, you could use a timer, set to 1 sec and 'automatic restart' set true. That will give you a tick every second.

2021-12-05_064109.thumb.jpg.312e4a18397ed996a2507fa80215e63b.jpg

 

Next you use the event 'timer expires' and put the code in there, instead of a user-defined event.

2021-12-05_065110.thumb.jpg.7b270bc99b0e6f3384c4e7391ad652ba.jpg

 

Hope that helps.

Best regards
Timba

Link zu diesem Kommentar
Auf anderen Seiten teilen

14 hours ago, Timba said:

Hi Curtis,

Bahnland's suggestion is not working because the event is not triggered. A user-defined event needs a call. For instance, you could use a timer, set to 1 sec and 'automatic restart' set true. That will give you a tick every second.

2021-12-05_064109.thumb.jpg.312e4a18397ed996a2507fa80215e63b.jpg

 

Next you use the event 'timer expires' and put the code in there, instead of a user-defined event.

2021-12-05_065110.thumb.jpg.7b270bc99b0e6f3384c4e7391ad652ba.jpg

 

Hope that helps.

Best regards
Timba

It does indeed help.   

I got it to do just what I wanted.

timers.thumb.jpg.d203408a1b071d9a31b60fc84dedb9a8.jpg

I used two timers of 2 seconds, offset by one second so that a timer expires every second.

timer1.thumb.jpg.0cc57605f40edca6c1c5c2645dc6e0f9.jpg

I set up 2 timer expires events with one for each timer.  Condition was as everyone has said except condition, not event.

One timer shuts off the front jets, and starts the back jets.  The other times turns on the front jets and shuts off the back jets.

561894678_FrontJet.thumb.jpg.a9336047a9ddb26904b080e2254f44f9.jpg

Here the Back Jet is shutting off and the Front Jet is opening.

 

Much thanks and regards

Curtis.

 

 

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