Skip to content

Ideas

The following ideas are foundational to Scratch and referenced throughout this specification:

Asset

A costume or sound.

Costume

A costume is an image file and a type of asset that can be graphically rendered to represent a target. It can be identified by its name or number. Costumes can either be bitmap or vector.

Sound

A sound is an audio file and a type of asset that can be audibly played to the user via blocks. It can be identified by its name.

Block

This will have to be better explained and added to the nonexistent section for script execution.

The fundamental component of Scratch as a programming language. In fact, it is similar to a function call in other programming languages. Every block:

  • Accepts values or blocks as arguments
  • Has a specific pre-defined operation that it performs
  • Can be run and reports (i.e. outputs, returns) a single value (or none at all)

Blocks can be run, meaning that its operation is performed using the arguments it is given and the value resulting from the operation is reported, if any. When put together, blocks create scripts.

Standard Blocks

Blocks that exist in Scratch 3.0. Generally, standard blocks are supported, meaning they are being actively maintained and probably will not be removed from Scratch in the future. They are the most commonly used blocks in scripts. All of them are documented in a dedicated section.

Hidden Blocks

Standard blocks that exist in Scratch 3.0 but are not actively supported or used on their own, either being kept for compatibility with projects created in older versions of Scratch or being used internally. Some are functional, some are not. Scripts may use them on occasion, but they are found less often than other standard blocks due to their obscurity. In the future they may be removed from Scratch entirely, and their consistent behavior or stability is not guranteed.

Clone

TODO: Research... 🤔🤔🤔

An independent, temporary copy created of a sprite that retains all of the original sprite's scripts, variables, lists, costumes, and sounds. It exists on its own entirely separate of the original sprite, so the scripts it runs only affect itself. Unlike sprites, it does not have a name, is not saved in project files, and can be deleted with blocks.

Since it does not have a name, it cannot be directly referenced via existing blocks (e.g. you cannot tell another sprite to glide to it). They are deleted when the runtime stops, and can also be deleted manually using the delete this clone block.

Clones can be created with the create clone block so long as the maximum number of clones has not been reached. Code can be written specifically for the clones of a sprite via the use of the when I start as a clone block. The stage is the only target which cannot be cloned, whereas both sprites and clones can themselves be cloned.

Edge

The usefulness of defining "Edge" is up for debate. It may be best left to the section about fencing. Feel free to offer insight!

A boundary around the viewing area of the stage that restricts the costume of a sprite from going off-screen.

Flag

The usefulness of defining "Flag" is up for debate. Feel free to offer insight!

The button that is clicked to start a project. It is also known as the green flag. In simple terms, it makes the project Go. When clicked, it runs any scripts placed under when flag clicked blocks.

JavaScript

Definitions for general terms indirectly related to Scratch may be put into their own section instead, however this is up for debate. Feel free to offer insight!

The programming language that Scratch 3.0 runs in. The logic it uses is largely similar to the logic Scratch uses due to Scratch's dependence on JavaScript for performing operations and manipulating values. In fact, this is where the type of value undefined is taken from; it is a type of value in JavaScript for representing what is not defined or known. Thanks to the quirks of Scratch and no-op hidden reporter blocks, we can obtain this type of value.

List

A series of items stored together in sequence. Each item is referenced by its numerical index (aka item #), a positive integer ranging from 1 to the length of the list (inclusive). Lists can be empty, meaning that they have a length of 0 and contain no items. There is also a maximum number of items that a list can hold, aka a limit to its length.

Mod

A modification (altered version) of the Scratch 3.0 runtime that is nonstandard and may introduce new blocks, features, or changes not present in standard Scratch. The majority of this spec will be documenting standard Scratch behavior. For information on nonstandard blocks and behaviors in mods, see Nonstandard Blocks.

Project

A stage and optionally some sprites packaged together to do something. They can be loaded into a runtime and executed. They can also be saved as project files.

Runtime

The environment in which a project is run. It keeps track of the project's current state and executes its code. Projects files can be loaded into and saved from runtimes.

Script

A set of blocks put together to create code. Here is an example of a script:

whenclickedaskWhat's your name?andwaitsayjoinHello, joinanswer!stopthis script

Blocks are put together in the following ways:

  • TODO 😄

Sprite

A kind of target that can exist on its own, have variables only it can set, and be moved, pointed, scaled, and hidden, all of which are things that the stage cannot do.

Stage

A special target, with one and only one existing in every project that is always shown behind all sprites. It is sort of like the global scope found in some programming languages, but it also exists as its own entity.

Unlike sprites, it cannot be moved, pointed, scaled, hidden, or have variables that only it can set. However, it can do everything else a sprite can.

Target

An object that runs blocks, shows images, and plays sounds. It has its own variables and scripts to perform operations. It can take the form of either a sprite or the stage.

A target exists as its own independent unit. However, targets can interact with each other in some ways, e.g. via messages.

User

The individual who is interacting with the project and provides input. They may optionally have a username that the project can use to identify them.

Variable

A named container belonging to a target that holds exactly one value and is interacted with via blocks. The following operations are often performed with variables:

  • Get: Read the current value of the variable.
  • Set: Modify the current value of the variable.

Some variables are created on a project-by-project basis for general use by scripts. For example, a (score) variable can be created to keep track of an arbitrary point value. Others are directly built into the runtime and cannot be deleted. For example, the (x position) variable always exists in every sprite to set its rendered horizontal position.

General purpose variables can be interacted with using variables blocks. Runtime variables have their own dedicated blocks instead and are usually limited or sandboxed in some way, unlike general purpose variables.