Detecting Turbo Mode

Материал из Поле цифровой дидактики

Detecting Turbo Mode can be done with a simple script:

whenclickedresettimerrepeat10switchbackdroptopleasewaitendiftimer>0.1thenswitchbackdroptopleaseuseturbomodestopallorrunsomeothercodeendswitchbackdroptoTurbomodedetected!

In turbo mode, the action of switching to the same background 10 times will take less than 0.1 seconds, but off it will take longer. If turbo mode is not on, the project will stop.

whenclickedsetCounterto0resettimerrepeatuntiltimer>1changeCounterby1endifCounter>100thenswitchbackdroptoTurboModedetected!oryourTurboModecode.elseswitchbackdroptoNormalModeoryourNormalModecode.End

This script is a little different. Turbo speed will greatly speed up the repeat until C Block and the counter variable value will be very high.

Single Stepping

Шаблон:Obsolete feature In Scratch 1.4, single stepping could be detected with the following script:

whenclickedresettimerswitchbackdroptoPleasewaitThisblockisrequired!iftimer>0.1thenswitchbackdroptoSinglesteppingdetectedelseswitchbackdroptoSinglesteppingoffend

The "switch to background" block can also be replaced with other blocks, such as "wait (0) seconds" if desired. Its purpose is to delay the script. If a script is single stepping, that block will take over 0.1 seconds to run, thus entering the "if" block.