Zho:加速模式的侦测

Detecting 加速模式 can be done with a simple 程式:

當 @greenflag 被點擊 計時器重置 重複 (10) 次 背景換成 [please wait v] end 如果 <(timer) > [0.1]> 那麼 背景換成 [please use turbo mode v] 停止 [全部 v] // or run some other code end 背景換成 [Turbo mode detected! v]

In turbo mode, the action of switching to the same 背景 10 times will take less than 0.1 seconds, but off it will take longer. If turbo mode is not on, the 专案 will 停止.

當 @greenflag 被點擊 變數 [Counter v] 設為 (0) 計時器重置 重複直到 <(timer) > [1]> 變數 [Counter v] 改變 (1) end 如果 <(Counter) > [100]> 那麼 背景換成 [Turbo speed detected! v]

背景換成 [Normal speed v] end This script is a little different. Turbo speed will greatly speed up the repeat until 半框形积木 and the counter 变量 value will be very high.

Single Stepping
In Scratch 1.4, single stepping could be detected with the following script:

當 @greenflag 被點擊 計時器重置 背景換成 [Please wait v] // This block is required! 如果 <(timer) > [0.1]> 那麼 背景換成 [Single stepping detected v]

背景換成 [Single stepping off v] end The "switch to background" 积木 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.