Jump to content

Empfohlene Beiträge

Geschrieben

see attached file to see an example of a situation that has been recuring.

without putting a defer execution command in front of these commands, they were not executed .

occurs frequently in my coding. It's sometimes very difficult to know why a routine doesn't work, and the problem is generating quit a few lines of defer execution.

anyone else experiencing this. Didn't seem to happen until I purchased a gaming computer, and now working on a new layout.

Thinking the computer will be the suspected problem !

defer Needed.jpg

Geschrieben

Hello @hmclay,
you may safely remove these delays.

They are inserted into the code when you convert a layout from pre V5 days.
The purpose was to ensure that the proper order of events from the old event manager is maintained.

Kind regards
Goetz

Geschrieben (bearbeitet)
vor 7 Stunden schrieb hmclay:

attached file

Why is there no difference between "if" and "else"? The else branch is superfluous. Actually, the whole procedure makes no sense.

Bearbeitet von Phrontistes
Geschrieben

 

16 hours ago, Goetz said:

Hello hmclay,
you may safely remove these delays.

They are inserted into the code when you convert a layout from pre V5 days.
The purpose was to ensure that the proper order of events from the old event manager is maintained.

Kind regards
Goetz

Goetz ... I had to insert them myself to get the routine to work. If I remove the delays, neither condition is executed.

 

14 hours ago, Phrontistes said:

Why is there no difference between "if" and "else"? The else branch is superfluous. Actually, the whole procedure makes no sense.

I do not understand this statement. The whole routine is, when a vehicle (Car) comes to the end of the road (Depot NW), if it is a "Farm" vehicle it is released to the Farm road, if its not, it goes to a "South Entrance" road. Part of an event "Vehicle Enters a Virtual Depot". Maybe there is a better way I'm not familiar with !

Geschrieben (bearbeitet)
vor 6 Stunden schrieb hmclay:

if it is a "Farm" vehicle it is released to the Farm road, if its not, it goes to a "South Entrance" road.

We can't see that in your screenshot, hmclay.
Both actions look identical to us.

 

vor 6 Stunden schrieb hmclay:

I had to insert them myself to get the routine to work.

And now I understand why
Your screenshot didn't show what triggered this event. 

When a vehicle enters a depot (which is your trigger event), it isn't immediately ready for exit. Your delay causes the event to be called a second time. And even with a delay of 0, this second call will occur one cycle later. Enough time for the studio to have the vehicle prepared for leaving the depot.

Kind regards
Goetz

Bearbeitet von Goetz
spelling
Geschrieben
vor 6 Stunden schrieb hmclay:

it is released to the Farm road, if its not, it goes to a "South Entrance"

Ok. You want different targets, which you can't see in your screenshot.

vor 6 Stunden schrieb hmclay:

I had to insert them myself to get the routine to work.

Unfortunately, the event type is not visible. If the event type is "Train/vehicle enters depot", then it's clear that a short delay is needed.

Geschrieben

OK ... thanks to all for the explanation. I though my computer was at fault, but it's normal behavior. I'm just starting to use Depots and Portals ... there is a lot to learn.

I though that Depots were used to direct or re-direct objects. so it never occurred to me that the routine would need an additional cycle to "digest" the input !

Also, I used snipit to get the image, so only the code that didn't work was displayed. Guessing I should use print screen ?

Geschrieben (bearbeitet)
vor 3 Stunden schrieb hmclay:

I though that Depots were used to direct or re-direct objects.

Actually, that's what portals are for.
The job of a depot is to store trains in a form which requires minimal CPU and GPU time.

An invisible train still requires tracking. It's still a collision object. It can move, affect switches, be affected by signals etc.
None of the above is required of a train in a depot. The train in the depot doesn't even have a location on the layout. This reorganisation must be finished before the train is available again. Typically, you wouldn't notice, because you'll have more than one train in your depot.

See proper explanation below from Neo

vor 3 Stunden schrieb hmclay:

I used snipit to get the image

Snipping is fine. Just snip a bit more ... like the line at the top which states what triggers this particular action.

Kind regards
Goetz

Bearbeitet von Goetz
correction
Geschrieben

In my case this is a useful effect.

When my vehicle enters the depot, another leaves (on other depot).

More realistic if it is not the same.

Disadvantages: 1 vehicle remains in depot permanently until sg. directs it out.

Geschrieben

The event "vehicle enters a virtual depot" is triggered before the vehicle is actually inserted into the depot to allow operations on the vehicle, because after inserting, the vehicle does not exist anymore on the layout and can not be addressed any further.

Kind regards,

Neo

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