(Redirected from Wait Until ())
Wait Until () | |
wait until <> | |
Category | Control |
Type | Stack |
Introduced in | 1.0 |
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] >
The block can also be used with lists, due to two reporter blocks' unusual property of being able to fit inside Boolean spaces.
- This script waits until there is an string in item 3
wait until (item [3] of [list v])
- This script waits until a specific string is in a list
wait until (item # of [thing] in [list v])
![]() | Only these two list reporter blocks have this property. No other reporter blocks can do this. |
Workaround
- Main article: List of Block Workarounds
This block can be replicated with an empty repeat until () block:
repeat until < . . . :: grey> end
The C insert is left empty; nothing is occuring while the block waits.