Archive.png This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective.
This article or section documents an outdated version of Scratch (version 1.4). For this article in the current version (version 3.0), see Making Scratch Crash (3.0). For this article in Scratch 2.0, see Making Scratch Crash (2.0).


Note Warning: This script will close Scratch without saving one's work. Be sure to save before testing this.

It is simple to make a project that closes when the Green Flag is clicked. This has been one way users try to prevent remixing, though it is actively discouraged by the Scratch Team. It has also not been successful, as you can open a remixed project without ever pressing the Green Flag. This is called making Scratch crash.

Method 1: Variables

  1. Create a project.
  2. Make a local variable called "variable".
  3. Add the following code to a sprite:
when gf clicked
hide
set [variable v] to [2]
forever
   set [variable v] to ((variable) * (variable))
end

Or

when gf clicked
hide
set [variable v] to [2]
forever
   change [variable v] by ([10 ^ v] of (variable))
end

Or

when gf clicked
hide
set [variable v] to [12]
forever
 set [variable v] to ((variable) * (variable))

Explanation

This script will fill Squeak's memory, and will force it to close. Squeak automatically crashes when a variable reaches a very high amount as it does not have the memory to maintain it. Since Scratch runs within the Squeak environment, Scratch closes when the Squeak environment closes. If a high RAM has been allotted to Scratch, it may just say "Infinity", and not close.

Method 2: Graphic Effects

  1. Get into the Scratch 1.4 Source Code and open the System Browser.
  2. Add 'water ripple' near the rest of the graphic effect names in Scratch-Objects >> ScriptableScratchMorph instance >> looks ops >> graphicEffectNames
  3. Save the changes and close the System Browser.
  4. Drag out a Set () Effect to () block and choose "water ripple" from the dropdown and set the value to 1 or higher. When the block is clicked, it will crash Scratch. Note that Squeak doesn't have enough memory to run the effect, so it crashes instead.[1][2]
when gf clicked
set [water ripple v] effect to (1)

Method 3: Hacked Block

  1. Get into the Scratch 1.4 Source Code and open the System Browser.
  2. In Scratch-Objects >> ScriptableScratchMorph class >> block specs >> blockSpecs add ('close Scratch' #- #closeScratch) at the end of the 'control' section
  3. Add the following in Scratch-Objects >> ScriptableScratchMorph instance >> other ops
closeScratch
	Smalltalk snapshot: false andQuit: true
  1. Save both the changes and close the System Browser.
  2. Drag out the close Scratch block that was just made, and run the block. Instead of crashing, Scratch closes without a warning.
when gf clicked
close Scratch :: control

References

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