Object timer stopped working

i have this code:



and for some reason it just stops working when there are more the 6 to 10 object but sometimes after 2 why is this?

Apologies in advance for this long winded explanation - but if you understand why it’s happening, you might find it easier to work with or around it.

It will be the trigger once that’s causing the problem. A trigger once event is ‘reset’ once it’s conditions are no longer met. So with one machine, if the timer was greater than 2 seconds and you reset the timer, which means the trigger once conditions aren’t met and the trigger once is ‘reset’.

But if you didn’t reset the timer, the event would be actioned once and then never again, because the trigger once condition never got the change to reset.

The timer check condition say “are there any machines with a timer > 2 seconds?”. I believe the reset timer action only gets performed on the first machine in the list created from the condition.

So when you have 2 machines with timers and they both get over the 2 sec threshold at the same time, the reset timer action is only performed on one of them, but not the other. The next time this event is met, the second machines time is still greater than 2 seconds. And because the trigger once applies to any machine, the second one never has it’s timer reset, and the trigger once condition never gets reset.

I hope that makes some kind of sense.


tldr;

My way of dealing this is type of logic is to remove the trigger once. It’s not needed - once you reset the timer, the machine won’t meet the trigger once conditions.

Instead have a for each object as a subevent of the timer check event, and in that subevent reset each machine timer and create the item.

Thanks! Do you mind sending a screen shot of the work around?

Something like:

Bit then all the timers will reset right?

The repeat for each instance is a subevent of the timer > 2 seconds condition. That condition will “pick” only the objects with timers > 2. So, the repeat each will only cycle through them.

1 Like