(Redirected from Undefined Blocks)

undefined
An obsolete block

Obsolete blocks are blocks that are not compatible with the version of Scratch being used; the interpreter cannot recognize them as actual blocks. They can be obtained by adding new code to a Scratch project's JSON file, which holds all specifications for a project. These blocks could previously be resurrected or created by using the Shift-Click-R method. Most of the resurrected blocks fail to work, but the stretch, abs, sqrt, point away from the edge, and some other blocks will function. The typical obsolete block is a command block, yet can fit in the space of any other type of block, as can be seen if you open up a project containing an (answer) block from Scratch 1.4 in any lower version of Scratch. Most of these blocks are red. The obsolete block that says "obsolete!" does nothing, and it is what all obsolete blocks appear as in the Experimental Viewer.

Undefined blocks are blocks that cannot be found as an actual script, and are undefined. One can get them as explained at the Getting an Obsolete or Undefined Block section.

For a list of obsolete blocks, see List of Obsolete Blocks.

How to Make an Obsolete Block

Scratch 3.0

This method uses the backpack[1]:

  1. Make a custom block.
  2. Put the block in the backpack. Do not put the define block into the backpack.
  3. Go to another project and put the custom block in.
  4. You have now made an undefined block.

Scratch 2.0

To obtain an obsolete (or undefined) block in Scratch 2.0, the user will need to create a custom block and drag the block (NOT the definition script) into their backpack. Once the user takes it out, it will turn into a red undefined block.

One can also create a obsolete block that is not colored or renamed by creating a custom block in either the stage or a sprite, and drag the block, NOT the definition script, into another sprite or without a custom block with the same name, and the block will become obsolete (but not colored red or renamed) because there is no definition script within the new sprite to define the block's procedure.

Scratch 1.x

There are two ways to get obsolete blocks in Scratch 1.x:

  1. Get an obsolete block from a Scratch Modification. These are the steps:
    1. Download and open a Scratch Modification that has blocks that are incompatible with Scratch (do not exist in Scratch)
    2. Put one of these blocks into a sprite
    3. Export the sprite
    4. Open this sprite in Scratch, and it will contain an obsolete block
  2. Edit the Scratch source to include a method and a blockspec that is not in the normal Scratch. When others download or play it, the block turns obsolete.

Offline/Online Sensor

Main article: Interface Detection
Archive.png
The subject of this article or section has changed dramatically and requires updating. Some information or images may not be accurate or relevant to the current version of Scratch, the Scratch website, or the article subject. (March 2022)


Obsolete blocks can also be used to detect whether a user is playing a project in the Java Player or the Experimental Viewer. Online, the script stops when it detects an undefined block, whereas when the project is played in Scratch 1.4, the script ignores the undefined block and carries on with the script. An offline/online sensor can be created with this script:

when green flag clicked
set [Offline/Online v] to [Online]
undefined
set [Offline/Online v] to [Offline]

A more complex version is this:

when green flag clicked
set [Playing... v] to [Offline]
broadcast ((0) / (0))
set [Playing... v] to [Online Java]
undefined
set [Playing... v] to [Online Flash]

Obsolete Hat Blocks in Scratch 3.0

The obsolete hat block.
Main article: Undefined Hat Block

Obsolete blocks no longer exist in Scratch 3.0. However, when a project's JSON is edited and an invalid block is created, the red block that appears as the result is the most similar thing as the undefined block in older versions.

For information on how to obtain this block, see Undefined Hat Block.

See Also

References

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