Add Delay Function

Hi, I am currently working on developing on a game on which I am working since long time. I know and I can create a delay using clock but can you Devs please import a new function in control
as delay and a number box attachable to it. So we can create a delay between two procedures or function.Please look ahead for this.

@Hrishikesh_Salokhe You can use the GetMillis procedure in clock. You can make two varibles, one for current milliseconds timestamp say currentMillis and another to compare the current Millis previousMillis. Once the comparison is done, update the variable previousMillis with the value of currentMillis. In this way, you can set delay of certain milliseconds.

Not sure that is great advice @sarkar. You should set any delay with a clock timer.

You can do lots with a Clock.

See this example for juggling three things simultaneously using a single clock.!msg/mitappinventortest/BOj2-ThEe3s/VlmXdcVOAgAJ

Yes, the method uses a clock timer.

This method is regularly used in embedded system codes, where you have a single hardware timer. Using a complete delay (aka pause), it halts the whole program. On the other hand, by creating routines for comparing milliseconds, you can set variable delays. Even in the above case, if the delays require a sync, then using millis comparison would be helpful.

@sarkar @Hrishikesh_Salokhe
Why is a wait procedure generally a bad idea?
The model of event processing in App Inventor by @Franklyn_A_Turbak
Please Wait method byScott


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

Woah! Thanks @Taifun. Yep, @TIMAI2 you were right.
There’s no guarantee the delay would work as expected in the method, and unlike embedded system, app is not running on a real-time system.

This might be the simplest implementation if you don't mind adding clocks, be reminded to un-check TimerAlwaysFires and TimerEnabled

Effectively a for loop with iteration 5, while loop is similar.