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.
SandCastleIcon.png This page has links to websites or programs not trusted by Scratch or hosted by Wikipedia. Remember to stay safe while using the Internet, as we can't guarantee the safety of other websites.

Mesh is a feature of Scratch 1.4 allowing users to interact over a computer network. Mesh allows projects to share variables and broadcasts, opening up a surprisingly large field of new project opportunities since technically sharing these two features is actually all that is needed to write most interacting programs.

How to get Mesh

There are three ways to access Mesh in Scratch 1.4:

Using the 1.4 Beta

The early beta version of Scratch 1.4 had Mesh enabled. This version was shared at the first formal Scratch Day. Only a few Scratchers were able to use this version. Mesh was disabled in the public release candidate of June of 2009.[1]

An image file of this build can be downloaded here.[dead link]

Using a Scratch Mod

Many Scratch modifications come with Mesh already included, without having to alter anything. One mod intended solely for the enabling of Mesh is available for download here.[dead link]

BYOB 3 and Panther also come with Mesh pre-enabled; the latter has many blocks to use Mesh.

Modifying Scratch

What the system browser should look like after editing it to activate Mesh.

This requires the use of the system browser.

  1. Shift-click the R in the Scratch logo.
  2. Select "turn fill screen off".
  3. A grey space will appear arround Scratch. Click on it and select "open…" followed by "browser".
  4. The system browser will appear. Select "Scratch-UI-Panes", followed by "ScratchFrameMorph", "menu/button actions", and "addServerCommandsTo:".
  5. The code of this method will appear below. Find t2 ← true and change it to t2 ← false.
  6. Right-click (if you are using Microsoft Windows) or hold down Control and click (otherwise) on the system browser and select "accept".
  7. Enter your initials and click "accept".
  8. Close the system browser.
  9. Shift-click the R again and select "turn fill screen on".
  • If you would like to keep using Mesh, Shift-click the R and select "save image for end-user" to save the image file.
  • If Mesh has been saved but is no longer wanted, repeat the steps but change false back to true.
  • To get the ← symbol, press _ (⇧ Shift+-).

How to Host and Join Mesh Sessions

Shift-clicking Share with Mesh enabled allows hosting and joining Mesh sessions.

Once Mesh has been enabled, Shift-clicking Share in the menu bar will reveal two new items: Host Mesh and Join Mesh.

  • Host Mesh begins a Mesh session and shows the user's local IP address. (This address is useful only for connecting over a local area network.)
  • Join Mesh joins a Mesh session given an IP address.

If the IP address of the computer has been forgotten, Share can be Shift-clicked and the item Show IP address selected.

A great number of Scratch processes can be connected to a single Mesh session.

Connecting Over the Internet

Normally, Mesh only works over a LAN (local area network), but it can be used over the internet by forwarding port 42001 on the router of the hosting user, which allows users to play Scratch projects together from across the world. (A program such as Hamachi could also be used, but this must be installed on every participant's computer.)

The Scratch 1.4 beta had a built-in system to allow Mesh to be used across the Internet without external programs or configuration.[citation needed]

How to Program with Mesh

During a Mesh session:

  • Broadcasts are received on all Scratch processes.
  • The for-all-sprites variables of each Scratch process can be read by the others.

A broadcast created in one Scratch process does not appear on the others until it is first sent, but one can also just make a broadcast with the same name.

The () Sensor Value block is used to find the value of a variable on another Scratch process. (The Variables palette only shows those variables of its Scratch process.) For example, this script could be used in one project:

when flag clicked
ask [What is my name?] and wait
set [name v] to (answer)
broadcast [greet v]

and this in another:

when I receive [greet v]
say (join [Hello, ] ([name v] sensor value)) for (2) secs

Broadcast () and Wait does not wait for scripts in other Scratch processes.

Sending and Receiving Lists

To share a list with Mesh, one can use broadcasts instead of Add () to (), Delete () of (), etc., or one can encode the list as a string and store it in a variable, which could be done by using the following script in the sending project:

when I receive [send list v]
set [# v] to [1]
set [result v] to []
repeat (length of [list v])
    set [result v] to (join (join (result) (item (#) of [list v])) [,])
    change [# v] by (1)
broadcast [list is ready v]

and the following in the receiving project:

when I receive [list is ready v]
delete (all v) of [list v]
set [# v] to [1]
set [item v] to []
repeat (length of ([result v] sensor value))
    if <(letter (#) of ([result v] sensor value)) = [,]> :: control
        add (item) to [list v]
        set [item v] to []
        set [item v] to (join (item) (letter (#) of ([result v] sensor value)))
    change [# v] by (1)

(This works as long as none of the items contain commas.)


A lot of things can go wrong when enabling and using Mesh, so here's a few things to check:

  • Make sure there is a period (.) after false in the system browser.
  • If changes made in the system browser were not saved, Mesh will no longer work when Scratch is closed.
  • If one would like to use Mesh over the internet:
    • Make sure port 42001 has been forwarded.
    • Make sure to use the host's internet address and not its local IP address.
  • If one is using a program such as Hamachi, make sure the Hamachi IP address is used rather than the computer's IP address.

Internals of Mesh

Mesh is based upon remote sensor connections; there is effectively no difference between hosting Mesh and enabling remote sensor connections.

Mesh need not be hosted by Scratch; FireMMO is an example of remote sensor connections used for multiplayer servers.

See Also

External Links


  1. johnadmin. (7/6/2009). "the experimental "mesh" feature was removed." ar-post:131585