Scratch commands are specified using the text equivalent (see example below).
Find a detailed reference on our Docs page.
when flag clicked
move (10) steps
say (hello) for (2) seconds
Conditions are specified used angled brackets <> for example
if <mouse down> then
change x by (10)
Drop down fields are specified with square brackets [] regardless of whether they appear on the Scratch block with square or rounded corners. The image will have the correct corners depending on the block, for example.
go to [random position]
When indenting use either two spaces or a tab for each level of indentation. It is important to be consistent with your indentation otherwise it will create issues when the code is being parsed.
This code uses two spaces for each level of indentation
repeat (4)
move (10) steps
if <key [space] pressed> then
turn right (90) degrees
Reporter blocks are specified by placing the name of the block in any value field.
For custom variables prefix them with the myvar! directive so that they will be displayed correctly.
y position
The Less than comparison is specified with "lt" instead of "<"
if <(y position) lt (-140)> then
go to [random position]
The greater than comparison is specified as "gt" and not ">"
repeat until <(x position) gt (100)>
move (10) steps
Scratch blocks with graphics are specified as shown in the code below. The text ":flag", ":right" and ":left" are automatically replaced with the the corresponding graphic.
when flag clicked
turn right (90) degrees
turn left (-20) degrees
When needing to specify colors simply state the Color, Saturation and Brightness values as shown in the code. Students can use the values to recreate the desired color.
if <touching color (c10 s20 b100)> then
hide
The Mystery directive is a great way to tests student's understanding of the material being taught.
Value fields, condition fields and entire blocks can be left blank by using the "mystery!" directive.
if <mystery! touching color (c10 s20 b100)> then
hide