The correct title of this article is When () > () (block). The Scratch Wiki uses this different title because of technical restrictions.
When () > ()
when [ v] > ()
Category Event
Type Hat
Introduced in 2.0

The When () > () block is an Events Block and a hat block. It starts the script below it when a value (chosen by the dropdown menu) is greater than another value (entered by the number input). Its options are loudness and timer. Video motion also used to be an option, but was replaced by the When video motion > () block in Scratch 3.0.

Run condition

This hat block will only re-run after its condition first stops being met, and then begins being met again. If the script is running when the condition stops and the starts being met, this will be ignored and the script will not be restarted.

For example, in the below snippet, the sprite will move by 10 steps only.

when [timer v] > (1) // Script "A"
wait (10) seconds
move (10) steps

when green flag clicked // Script "B"
wait (2) seconds
reset timer

When the timer gets to 1 for a second time, "A" will still be running and so will not register that change.

However, in the below snippet, the sprite will move by 20 steps.

when [timer v] > (1)
move (10) steps

when green flag clicked
wait (1.5) seconds // Wait for the first script to start
reset timer

After the first script stops, the timer will wait half a second before passing over 1 again, causing the script to run twice and the sprite to move twenty steps.

Values

Loudness

Main article: Loudness (value)

The loudness in the drop-down menu represents the volume of the sound that the computer microphone is picking up. The highest value is 100, and the lowest value is 1. Once the loudness is higher than the chosen amount, the script will begin to run.

Timer

Main article: Timer (value)

The timer variable is default on Scratch and constantly running, and it can be reset. It counts up from 0. Once the timer's value is greater than the chosen time, the script will run.

Example Uses

This block can be used for many things, such as:

  • Saying something when voice is entered
when [loudness v] > (10)
say [Be quiet!] for (2) seconds
  • Starting something after a delay
when [timer v] > (10)
broadcast (end game v)

Workaround

Main article: List of Block Workarounds

Using a wait until block in conjunction with the greater than or less than blocks can create a workaround for this block.

forever
wait until <(loudness) > (20)>
. . .
wait until <not <(loudness) > (20)>>

Unceasing Timer Exploit

This event block has been occasionally used to create projects that cannot be stopped. The following blocks cannot be stopped by pressing the red stop sign once the project has started.

when [timer v] > (0)
reset timer
forever
reset timer
. . .
end

This method can be used to simulate a when stop clicked block.

See Also

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