This article is a list of block opcodes, which are strings naming a block in the Scratch File Format.

Motion Blocks

Block Opcode
move () steps motion_movesteps
turn cw () degrees motion_turnright
turn ccw () degrees motion_turnleft
go to ( v) motion_goto
go to x: () y: () motion_gotoxy
glide () secs to ( v) motion_glideto
glide () secs to x: () y: () motion_glidesecstoxy
point in direction () motion_pointindirection
point towards ( v) motion_pointtowards
change x by () motion_changexby
set x to () motion_setx
change y by () motion_changeyby
set y to () motion_sety
if on edge, bounce motion_ifonedgebounce
set rotation style [ v] motion_setrotationstyle
(x position) motion_xposition
(y position) motion_yposition
(direction) motion_direction

Looks Blocks

Block Opcode
say () for () seconds looks_sayforsecs
say () looks_say
think () for () seconds looks_thinkforsecs
think () looks_think
switch costume to ( v) looks_switchcostumeto
next costume looks_nextcostume
switch backdrop to ( v) looks_switchbackdropto
switch backdrop to ( v) and wait looks_switchbackdroptoandwait
next backdrop looks_nextbackdrop
change size by () looks_changesizeby
set size to ()% looks_setsizeto
change [ v] effect by () looks_changeeffectby
set [ v] effect to () looks_seteffectto
clear graphic effects looks_cleargraphiceffects
show looks_show
hide looks_hide
go to [ v] layer looks_gotofrontback
go [ v] () layers looks_goforwardbackwardlayers
costume [ v] looks_costumenumbername
backdrop [ v] looks_backdropnumbername
size looks_size

Sound Blocks

Block Opcode
play sound ( v) until done sound_playuntildone
start sound ( v) sound_play
stop all sounds sound_stopallsounds
change [ v] effect by ():: sound sound_changeeffectby
set [ v] effect to ():: sound sound_seteffectto
clear sound effects sound_cleareffects
change volume by () sound_changevolumeby
set volume to ()% sound_setvolumeto
(volume) sound_volume

Events Blocks

Block Opcode
when gf clicked event_whenflagclicked
when [ v] key pressed event_whenkeypressed
when this sprite clicked event_whenthisspriteclicked
when stage clicked event_whenstageclicked
when backdrop switches to [ v] event_whenbackdropswitchesto
when [ v] > () event_whengreaterthan
when I receive [ v] event_whenbroadcastreceived
broadcast ( v) event_broadcast
broadcast ( v) and wait event_broadcastandwait

Control Blocks

Block Opcode
wait () seconds control_wait
repeat () motion_turnright
forever control_forever
if <> then control_if
if <> then
wait until <> control_wait_until
repeat until <> control_repeat_until
stop [ v] control_stop
when I start as a clone control_start_as_clone
create clone of ( v) control_create_clone_of
delete this clone control_delete_this_clone

Sensing Blocks

Block Opcode
<touching ( v)?> sensing_touchingobject
<touching color (#000000)?> sensing_touchingcolor
color (#000000) is touching (#000000)? sensing_coloristouchingcolor
(distance to ( v)) sensing_distanceto
ask () and wait sensing_askandwait
(answer) sensing_answer
<key ( v) pressed?> sensing_keypressed
<mouse down?> sensing_mousedown
(mouse x) sensing_mousex
(mouse y) sensing_mousey
set drag mode [ v] sensing_setdragmode
(loudness) sensing_loudness
(timer) sensing_timer
reset timer sensing_resettimer
[ v] of ( v) sensing_of
current [ v] sensing_current
(days since 2000) sensing_dayssince2000
(username) sensing_username

Operators Blocks

Block Opcode
()+() operator_add
()-() operator_subtract
()*() operator_multiply
()/() operator_divide
(pick random () to ()) operator_random
<()>()> operator_gt
<()<()> operator_lt
<()=()> operator_equals
<<>and<>> operator_and
<<>or<>> operator_or
<not<>> operator_not
(join()()) operator_join
(letter () of ()) operator_letter_of
(length of ()) operator_length
<() contains ()?> operator_contains
(()mod()) operator_mod
(round()) operator_round
[ v] of ()::operators operator_mathop

Variables Blocks

Variables Blocks (subcategory)

Block Opcode
( ::variables) data_variable
set [ v] to () data_setvariableto
change [ v] by () data_changevariableby
show variable [ v] data_showvariable
hide variable [ v] data_hidevariable

List Blocks

Block Opcode
( ::list) data_listcontents
add () to [ v] data_addtolist
delete () of [ v] data_deleteoflist
delete all of [ v] data_deletealloflist
insert () at () of [ v] data_insertatlist
replace item () of [ v] with () data_replaceitemoflist
(item () of [ v]) data_itemoflist
(item # of () in [ v]) data_itemnumoflist
(length of [ v]) data_lengthoflist
<[ v] contains ()?> data_listcontainsitem
show list [ v] data_showlist
hide list [ v] data_hidelist

My Blocks

Block Opcode
define procedures_definition
:: custom procedures_call
(:: custom) argument_reporter_string_number
< :: custom> argument_reporter_boolean

Music Extension

Block Opcode
play drum ( v) for () beats music_playDrumForBeats
rest for () beats music_restForBeats
play note () for () beats music_playNoteForBeats
set instrument to ( v) music_setInstrument
set tempo to () music_setTempo
change tempo by () music_changeTempo
(tempo) music_getTempo

Pen Extension

Block Opcode
erase all pen_clear
stamp pen_stamp
pen down pen_penDown
pen up pen_penUp
set pen color to (#000000) pen_setPenColorToColor
change pen ( v) by () pen_changePenColorParamBy
set pen ( v) to () pen_setPenColorParamTo
change pen size by () pen_changePenSizeBy
set pen size to () pen_setPenSizeTo

Video Sensing Extension

Block Opcode
when video motion > () videoSensing_whenMotionGreaterThan
video ( v) on ( v) videoSensing_videoOn
turn video ( v) videoSensing_videoToggle
set video transparency to () videoSensing_setVideoTransparency

Text to Speech Extension

Block Opcode
speak () text2speech_speakAndWait
set voice to ( v) text2speech_setVoice
set language to ( v) text2speech_setLanguage

Translate Extension

Block Opcode
(translate () to ( v)) translate_getTranslate
(language) translate_getViewerLanguage

Makey Makey Extension

Block Opcode
when ( v) key pressed:: makeymakey makeymakey_whenMakeyKeyPressed
when ( v) pressed in order makeymakey_whenCodePressed

micro:bit Extension

Block Opcode
when ( v) button pressed microbit_whenButtonPressed
<( v) button pressed?> microbit_isButtonPressed
when ( v):: microbit microbit_whenGesture
display ( v) microbit_displaySymbol
display text () microbit_displayText
clear display microbit_displayClear
when tilted ( v) microbit_whenTilted
<tilted ( v)?> microbit_isTilted
(tilt angle ( v)) microbit_getTiltAngle
when pin ( v) connected microbit_whenPinConnected


Block Opcode
motor ( v) turn this way for () seconds ev3_motorTurnClockwise
motor ( v) turn that way for () seconds ev3_motorTurnCounterClockwise
motor ( v) set power ()% ev3_motorSetPower
(motor ( v) position) ev3_getMotorPosition
button ( v) pressed ev3_whenButtonPressed
when distance \< () ev3_whenDistanceLessThan
when brightness \< () ev3_whenBrightnessLessThan
<button ( v) pressed?> ev3_buttonPressed
(distance) ev3_getDistance
(brightness) ev3_getBrightness
beep note () for () secs ev3_beep

LEGO BOOST Extension

Block Opcode
turn motor ( v) for () seconds boost_motorOnFor
turn motor ( v) for () rotations boost_motorOnForRotation
turn motor ( v) on boost_motorOn
turn motor ( v) off boost_motorOff
set motor ( v) speed to ()% boost_setMotorPower
set motor ( v) direction ( v) boost_setMotorDirection
(motor ( v) position:: boost) boost_getMotorPosition
when ( v) brick seen boost_whenColor
<seeing ( v) brick?> boost_seeingColor
when tilted ( v):: boost boost_whenTilted
(tilt angle ( v):: boost) boost_getTiltAngle
set light color to ():: boost boost_setLightHue

LEGO Education WeDo 2.0 Extension

Block Opcode
turn ( v) on for () seconds wedo2_motorOnFor
turn ( v) on wedo2_motorOn
turn ( v) off wedo2_motorOff
set ( v) power to () wedo2_startMotorPower
set ( v) direction to ( v) wedo2_setMotorDirection
set light color to () wedo2_setLightHue
when distance ( v) () wedo2_whenDistance
when tilted ( v):: wedo wedo2_whenTilted
(distance:: wedo) wedo2_getDistance
<tilted ( v):: wedo> wedo2_isTilted
(tilt angle ( v):: wedo) wedo2_getTiltAngle

Go Direct Force & Acceleration Extension

Block Opcode
when ( v) gdxfor_whenGesture
when force sensor ( v) gdxfor_whenForcePushedOrPulled
(force) gdxfor_getForce
when tilted ( v):: gdxfor gdxfor_whenTilted
<tilted ( v)?:: gdxfor> gdxfor_isTilted
tilt angle ( v):: gdxfor gdxfor_getTilt
<falling?> gdxfor_isFreeFalling
(spin speed ( v)) gdxfor_getSpinSpeed
(acceleration ( v)) gdxfor_getAcceleration

CoreEx Extension

Block Opcode
(example block:: extension) coreExample_exampleOpcode
block with image @turnRight inline:: extension coreExample_exampleWithInlineImage

Hidden Blocks

Block Opcode
scroll right ():: motion motion_scroll_right
scroll up ():: motion motion_scroll_up
align scene [ v]:: motion motion_align_scene
(x scroll:: motion) motion_xscroll
(y scroll:: motion) motion_yscroll
hide all sprites:: looks looks_hideallsprites
set stretch to ()%:: looks looks_setstretchto
change stretch by ():: looks looks_changestretchby
when this sprite touches ( v):: events hat event_whentouchingobject
for each [ v] in () {
}:: control
while <> {
}:: control
(counter:: control) control_get_counter
increment counter:: control control_incr_counter
clear counter:: control control_clear_counter
all at once {
}:: control
<loud?:: sensing> sensing_loud
(user id:: sensing) sensing_userid
Unused List Block SVG.svg data_listindexall
Unused List Block SVG.svg data_listindexrandom
play drum () for () beats:: music music_midiPlayDrumForBeats
set instrument to ():: music music_midiSetInstrument
set pen color to ():: pen pen_setPenHueToNumber
change pen color by ():: pen pen_changePenHueBy
set pen shade to ():: pen pen_setPenShadeToNumber
change pen shade by ():: pen pen_changePenShadeBy
play note () for () seconds:: wedo wedo2_playNoteFor

Internal Drop-Down Reporters

Parent Block(s) Internal Reporter Opcode
go to ( v) ([ v]:: motion) motion_goto_menu
glide () secs to ( v) ([ v]:: motion) motion_glideto_menu
point towards ( v) ([ v]:: motion) motion_pointtowards_menu
switch costume to ( v) ([ v]:: looks) looks_costume
switch backdrop to ( v), switch backdrop to ( v) and wait ([ v]:: looks) looks_backdrops
play sound ( v) until done, play sound ( v) ([ v]:: sound) sound_sounds_menu
broadcast ( v), broadcast ( v) and wait ([ v]:: events) event_broadcast_menu
create clone of ( v) ([ v]:: control) control_create_clone_of_menu
<touching ( v)> ([ v]:: sensing) sensing_touchingobjectmenu
(distance to ( v)) ([ v]:: sensing) sensing_distancetomenu
<key ( v) pressed?> ([ v]:: sensing) sensing_keyoptions
[ v] of ( v) ([ v]:: sensing) sensing_of_object_menu
play drum ( v) for () beats ([ v]:: extension) music_menu_DRUM
set instrument to ( v) ([ v]:: extension) music_menu_INSTRUMENT
change pen ( v) by (), set pen ( v) to () ([ v]:: extension) pen_menu_colorParam
video ( v) on ( v) (first drop-down input) ([ v]:: extension) videoSensing_menu_ATTRIBUTE
video ( v) on ( v) (second drop-down input) ([ v]:: extension) videoSensing_menu_SUBJECT
turn video ( v) ([ v]:: extension) videoSensing_menu_VIDEO_STATE
set voice to ( v) ([ v]:: extension) text2speech_menu_voices
set language to ( v) ([ v]:: extension) text2speech_menu_languages
translate () to ( v) ([ v]:: extension) translate_menu_languages
when ( v) key pressed:: makeymakey ([ v]:: extension) makeymakey_menu_KEY
when ( v) pressed in order ([ v]:: extension) makeymakey_menu_SEQUENCE
when ( v) button pressed, ( v) button pressed? ([ v]:: extension) microbit_menu_buttons
when ( v):: microbit ([ v]:: extension) microbit_menu_gestures
when tilted ( v), tilted ( v)? ([ v]:: extension) microbit_menu_tiltDirectionAny
tilt angle ( v) ([ v]:: extension) microbit_menu_tiltDirection
when pin ( v) connected ([ v]:: extension) microbit_menu_touchPins
motor ( v) turn this way for () seconds, motor ( v) turn that way for () seconds, motor ( v) set power ()%, motor ( v) position ([ v]:: extension) ev3_menu_motorPorts
when button ( v) pressed, <button ( v) pressed?> ([ v]:: extension) ev3_menu_sensorPorts
turn motor ( v) for () seconds, turn motor ( v) for () rotations, turn motor ( v) on, turn motor ( v) off, set motor ( v) speed to ()%, set motor ( v) direction ( v) (first drop-down input) ([ v]:: extension) boost_menu_MOTOR_ID
set motor ( v) direction ( v) (second drop-down input) ([ v]:: extension) boost_menu_MOTOR_DIRECTION
motor ( v) position:: boost ([ v]:: extension) boost_menu_MOTOR_REPORTER_ID
when ( v) brick seen, <seeing ( v) brick?> ([ v]:: extension) boost_menu_COLOR
when tilted ( v):: boost ([ v]:: extension) boost_menu_TILT_DIRECTION_ANY
tilt angle ( v):: boost ([ v]:: extension) boost_menu_TILT_DIRECTION
turn ( v) on for () seconds, turn ( v) on, turn ( v) off, set ( v) power to (), set ( v) direction to ( v) (first drop-down input) ([ v]:: extension) wedo2_menu_MOTOR_ID
set ( v) direction to ( v) (second drop-down input) ([ v]:: extension) wedo2_menu_MOTOR_DIRECTION
when distance ( v) () ([ v]:: extension) wedo2_menu_OP
when tilted ( v):: wedo, <tilted ( v)?:: wedo> ([ v]:: extension) wedo2_menu_TILT_DIRECTION_ANY
tilt angle ( v):: wedo ([ v]:: extension) wedo2_menu_TILT_DIRECTION
when ( v) ([ v]:: extension) gdxfor_menu_gestureOptions
when force sensor ( v) ([ v]:: extension) gdxfor_menu_pushPullOptions
when tilted ( v):: gdxfor, <tilted ( v)?:: gdxfor> ([ v]:: extension) gdxfor_menu_tiltAnyOptions
tilt angle ( v):: gdxfor ([ v]:: extension) gdxfor_menu_tiltOptions
spin speed ( v), acceleration ( v) ([ v]:: extension) gdxfor_menu_axisOptions

Hidden Internal Drop-Down Reporters

Parent Block(s) Internal Reporter Opcode
when this sprite touches ( v):: events hat ([ v]:: events) event_touchingobjectmenu
None ([ v]:: extension) microbit_menu_pinState

Special Internal Input Blocks

Parent Block(s) Internal Reporter Opcode
define :: custom procedures_prototype
play note () for () beats (first input), beep note () for () secs (first input), play note () for () seconds:: wedo (first input) Note input in a round block.png note
display ( v) Micro-bit display input in join block.png matrix

See Also

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