loop not working
When adding a simple loop with number of times to execute put to 5 and then adding an alert popup which should be shown 5 times.
But the alert is actually only shown once (with index 4).
What am I doing wrong?
@Lupo The alert popup is actually executed 5 times - the problem is that you can only see one popup at once, so you're really seeing the last one.
You can see that the alert behavior has a little lightning icon - that means that it triggers after an event. You can make it so the after the alert is closed, another one can pop up.
@RobinsonX Actuall the popup was only test. Same effect I have when replacing the popup with a Wait 1s and then playing a sound. I only hear the sound once after 1 second. I expected to hear the sound 5 times with 1 second intervall…
@Lupo Last time I checked, it seems that Loop basically ignores any wait/time-based/event behaviours.
I do hope they will add support for this in the future.
@Lupo The loop triggers events instantaneously, so it doesn't wait until the behaviors under it are done executing like Kamdroid said.
The wait behavior would execute once because every time it's executed, it interrupts its previous instance - it's like resetting a clock every time it executes.
The way you would achieve something like this is to connect the behaviors from the bottom to the top so it makes a loop. When you want to stop the loop, use the
Behavior Offbehavior to interrupt the chain of events.