Wait Until ()
wait until <>
Category Control
Type Stack

The wait until () block is a control block and a stack block. The block pauses its script until the specified Boolean condition is true.

Example Uses

As the block pauses its script until a condition is true, it is mainly used when a script must wait for a certain event. Some common uses include:

  • Waiting for a sprite to move somewhere
wait until < ( [x position v] of (Sprite1 v) ) > [50] >
  • Waiting for a variable to reach a certain amount
wait until < ( meter ) = [10] >
  • Waiting for a reply from another script or sprite
wait until < ( ready? ) = [1] >

It can also be used to detect if the mouse-pointer is released when touching a sprite:

when gf clicked
wait until <mouse down?>
wait until <not <mouse down?>>
if <touching (mouse-pointer v)?> then
code here //This code will execute if the mouse-pointer is released while touching the sprite.


Main article: List of Block Workarounds

This block can be replicated with an empty repeat until () block:

repeat until < . . .:: grey>

The C insert is left empty; nothing is occuring while the block waits.

See Also

Cookies help us deliver our services. By using our services, you agree to our use of cookies.