From Test-Scratch-Wiki

Wait Until ()
2.0 Wait Until ().png
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:

  • Waiting for a sprite to move somewhere
wait until <([x position v] of [Sprite1 v]) > [50]>
  • Waiting for a variable to pass a certain amount
wait until <(meter) > [10]>
  • Waiting for a reply from another script or sprite
wait until <(ready?) = [1]>
  • Waiting a precise amount of time
set [last time v] to (timer)
wait until <((timer) - (last time)) > (0.5)> //waits 0.5 seconds

Workaround

Main article: List of Block Workarounds

This block can be replicated with an empty Repeat Until () block:

repeat until <condition goes here>
//empty
end

The C insert is left empty so nothing happens while the block waits.

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