(Redirected from When () is more than () (block))
- The correct title of this article is When () > () (block). The Scratch Wiki uses this different title because of technical restrictions.
|When () > ()|
when [ v] > ()
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, timer. Video motion also used to be an option, but was replaced by the video () on () block in Scratch 3.0. 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) ::hat events // 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) ::hat events 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 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.
- 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.
- 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.
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
- Being motion activated
when [video motion v] > (10) broadcast [start v]
- Starting something after a delay
when [timer v] > (10) broadcast [end game v]
- Main article: List of Block Workarounds
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.