(Redirected from Hacked Blocks)
Hidden blocks are blocks that exist in Scratch, but are not shown in the Block Palette in the Scratch User Interface. They can be inserted into Scratch projects by editing the project file. Most hidden blocks in Scratch exist to maintain compatibility with older versions of Scratch, although many of them do not function properly.
When using hidden blocks, there's no guarantee that they will work with future updates to Scratch. The project that used the hidden blocks might be marked as NFE.[citation needed] |
Hidden blocks can be added by downloading a project, changing the file extension from .sb3
to .zip
(Scratch project files are actually zipped folders, but if the file extension is left the same most file managers will not have an option to extract the files), and extracting the folder. This will result in a folder containing .svg
and .wav
files for the costumes and sounds, respectively; it will also contain a file named project.json
. Open this in a text editor like Notepad; the file format is described in Scratch File Format.
A new block can be made using the block's associated opcode (opcodes are under its associated section in this article) in the .json
file, where the block should appear once all the files are zipped (not the folder they are contained in; only zip the files) and the file extension is changed to .sb3
(in Windows' File Explorer, files are shown without a file extension by default, so one may have to enable file extensions on the View tab) before being loaded it in Scratch. It is also possible to load the .zip
file without renaming it by choosing "All files" in the file type menu when loading the project.
Motion
Scroll Right () and Scroll Up ()
scroll right (10):: motion scroll up (10):: motion
- Main article: Scroll Right ()
- Main article: Scroll Up ()
Opcodes: motion_scroll_right
, motion_scroll_up
These blocks do not do anything. In 2.0 alpha, these blocks would scroll the backdrop horizontally and vertically.
Align Scene ()
Align Scene () | |
align scene [bottom-left v]:: motion | |
Type | Stack |
- Main article: Align Scene ()
Opcode: motion_align_scene
This block does not do anything. The drop down has the following options:
- bottom-left
- bottom-right
- middle
- top-left
- top-right
In 2.0 alpha, this block would align the backdrop to the selected position.
Scroll Position
(x scroll:: motion) (y scroll:: motion)
- Main article: X Scroll
- Main article: Y Scroll
Opcodes: motion_xscroll
, motion_yscroll
These reporter blocks do not return a result. Clicking on them will show no pop-up box at all, but they otherwise function as the string "undefined".
Looks
Hide All Sprites
Hide All Sprites | |
hide all sprites:: looks | |
Type | Stack |
- Main article: Hide All Sprites
Opcode: looks_hideallsprites
This block does not do anything. In 2.0 alpha, this block would hide all currently visible sprites.
Stretch
set stretch to (100)%:: looks change stretch by (10):: looks
- Main article: Set Stretch to ()%
- Main article: Change Stretch by ()
Opcodes: looks_setstretchto
, looks_changestretchby
These two blocks do not do anything either. In Scratch 1.x, these blocks would do as their names imply.
Events
When this Sprite Touches ()
when this sprite touches (mouse-pointer v):: events hat ([mouse-pointer v]:: events)
Opcodes: event_whentouchingobject
, event_touchingobjectmenu
This hat block activates when the sprite comes into contact with the selected object. The dropdown menu is similar to the <touching (mouse-pointer v)?>
dropdown, but does not list any sprites. The second block is used internally as an input to the first one.
Control
For Each () in ()
For Each () in () | |
for each [variable v] in (10) { }:: control loop | |
Type | C |
- Main article: For Each () in ()
Opcodes: control_for_each
The variable selected using the dropdown is set to 1, and increases on each iteration of the script inside the loop, until it reaches the specified end point. (For example, in the above example, the script inside would be executed 10 times, with the variable ranging from 1 to 10.)
While ()
While () | |
while <> { }:: control loop | |
Type | C |
- Main article: While ()
Opcode: control_while
This is essentially the opposite of the repeat until block. The script inside the loop is executed until the Boolean is false.
Counter
(counter:: control) increment counter:: control clear counter:: control
- Main article: Counter
- Main article: Incr Counter
- Main article: Clear Counter
Opcodes: control_get_counter
, control_incr_counter
, control_clear_counter
These blocks are pretty self-explanatory. (counter:: control)
returns the state of the counter, increment counter:: control
increments the counter by 1, and clear counter:: control
sets it to 0.
All at Once
All at Once | |
all at once { }:: control | |
Type | C |
- Main article: All at Once
Opcode: control_all_at_once
This C block has no effect.[1] It was added for backwards compatibility, similar to the scroll blocks. In early versions of Scratch 2.0, this block was visible, and functioned similarly to the "run without screen refresh" option in custom blocks.
Sensing
Loud?
Loud? | |
<loud?:: sensing> | |
Type | Boolean |
- Main article: Loud?
Opcode: sensing_loud
In Scratch 2.0 or later, returns true if <(loudness) > (10)>
, and returns false otherwise.[2]
In Scratch 1.x, it returned true only if <(loudness) > (30)>
.
User ID
User ID | |
(user id:: sensing) | |
Type | Reporter |
- Main article: User ID
Opcode: sensing_userid
This block does not return a value, similar to the (x scroll:: motion)
and (y scroll:: motion)
blocks. In 2.0 alpha, this block returned a number unique to the viewer of the project.
Variables
Random list index and All list index
Opcodes: data_listindexall
, data_listindexrandom
These blocks both have a nonfunctional dropdown icon, and a positive integer can be typed into the blocks. The blocks return the inputted value.
In early versions of Scratch 3.0, they were used as internal inputs to list blocks ("data_listindexall" was an internal input to the Item () of () block while "data_listindexrandom" was an internal input to the Insert () at () of (), Replace Item () of () with (), and Item () of () blocks). Much like in Scratch 2.0, when the dropdown icon was clicked, a menu would appear with extra options containing non-numerical values. The options were "1", "last", and "all" for "data_listindexall", and "1", "last", and "random" for "data_listindexrandom".
Music Extension
Play Drum () for () Beats (obsolete block)
- Main article: Play Drum () for () Beats (obsolete block)
Play Drum () for () Beats | |
play drum (1) for (0.25) beats:: music | |
Type | Stack |
Opcode: music_midiPlayDrumForBeats
This block was originally in Scratch 1.4. It was removed in favor of the play drum ( v) for () beats
block for Scratch 2.0.
Set Instrument to () (obsolete block)
- Main article: Set Instrument to () (obsolete block)
Set Instrument to () | |
set instrument to (1):: music | |
Type | Stack |
Opcode: music_midiSetInstrument
Similar to the block above, this block was originally in Scratch 1.4, but was removed in favor of the set instrument to ( v)
block for Scratch 2.0.
Pen Extension
Set Pen Color to () (number input block), Change Pen Color by (), Set Pen Shade to (), and Change Pen Shade by ()
set pen color to (10):: pen change pen color by (15)::pen set pen shade to (10):: pen change pen shade by (15):: pen
- Main article: Set Pen Color to () (number input block)
- Main article: Change Pen Color by ()
- Main article: Set Pen Shade to ()
- Main article: Change Pen Shade by ()
Opcodes: pen_setPenHueToNumber
, pen_changePenHueBy
, pen_setPenShadeToNumber
, pen_changePenShadeBy
These blocks were added in Scratch 2.0. However, they were removed in favor of the set pen ( v) to ()
and change pen ( v) by ()
blocks for Scratch 3.0.
Micro:bit Extension
Micro:bit Pin State Menu
Micro:bit pin state menu | |
([on v]:: extension) |
Opcode: microbit_menu_pinState
This block is an unused internal input, having no associated parent block. It only has two options in its dropdown, being "on" and "off".
Lego Education WeDo 2.0 Extension
Play Note () for () Seconds
- Main article: Play Note () for () Seconds
Play Note () for () Seconds | |
play note (60) for (0.25) seconds:: wedo | |
Type | Stack |
Opcode: wedo2_playNoteFor
This block is perfectly functional, and acts very similarly to the beep note () for () secs
block. It was available in Scratch 2.0, but was removed in Scratch 3.0 because the sound produced from the Lego WeDo was very quiet.[3]
CoreEx Extension
The CoreEx Extension is a hidden extension not available through the Extensions Library. It was used to test the conversion of built-in block categories to extensions,[4] and contains two blocks.
CoreEx Example block and CoreEx Image block
(example block:: extension) block with image @turnRight inline:: extension
Opcodes: coreExample_exampleWithInlineImage
, coreExample_exampleOpcode
The (example block:: extension)
block returns the string "Stage", while the block with image @turnRight inline:: extension
block does nothing.[5]
Undefined "Red" Blocks
Undefined Hat Block
- Main article: Undefined Hat Block
Opcode: undefined
[note 1]
This block is generated by an error. It can not be connected with any other block, and doesn't have any function. Some Scratchers call it a Hat Block but it is actually a combination of both a hat and Cap Block. It does not have an input, and is the only red block in Scratch 3.0. Unlike other blocks, it does not have an outline. It cannot be commented on, and trying to comment on this block will cause the block to follow the mouse. Going to a different sprite while it's following the mouse will cause the block to disappear, and attempting to go back to the original sprite causes the block to become immobile. Going to the Costumes or Sound Tab and returning to the code will crash the project.
- ↑ Any nonexistent opcode will work, but "undefined" is the opcode when creating it by naming a custom block the NAK character.
Internal Reporters
Due to a limitation in the Blockly engine, many reporters (known as internal reporters or shadow blocks)[6] exist for the sole purpose of adding inputs to other blocks.[7] Though these are technically used and available in the palette, they cannot normally be observed independent of their parent blocks without modifying the project file.
Internal Dropdown Reporters
([random position v]:: #4280d7)
- Main article: Hidden Blocks/Internal Dropdown Reporters
All blocks with an insertable dropdown menu are composed of a parent block and an internal dropdown reporter. When isolated, they look like a reporter block with a non-insertable dropdown menu, and they report a value corresponding to the option selected in the dropdown menu.
A full list of all internal dropdown reporters can be found here.
Special Internal Reporters
In addition to internal dropdown reporters, there exists seven other internal reporters blocks. These internal reporters are used much less frequently, only being used for the inputs of a few different blocks.
Color picker
Color picker | |
(::#1b37da) |
Opcode: colour_picker
This block provides the color input for blocks such as <touching color [#1b37da]?>
. When clicked, it displays a color picker allowing the user to choose any color using sliders, or by picking from the stage.
Prototype
Prototype | |
::custom | |
Type | Hat (Looks like a Stack Block) |
Opcode: procedures_prototype
This block is a block hidden internally in custom block definitions, and shares its appearance with the stack custom blocks. It also makes its associated stack custom block appear in the block palette. When run on its own, the block does nothing. Even though it has the appearance of a stack block, it works like a hat block, in other words, blocks can't be connected to the top of this block, except a definition block. No option is present to edit the block under its context menu, but it can still be renamed by dragging the block into a custom block definition and editing said custom block definition.
Boolean, Reporter, and Text editors
Opcodes: argument_editor_boolean
, argument_editor_string_number
, procedures_declaration
These blocks are internally used when making custom blocks and allow for reporter inputs, boolean inputs, and labels to be added or removed to a custom block. Like when they are used in the Make a Block menu, clicking on them displays a trash can icon. However, these buttons don't do anything outside of the Make a Block menu (such as the Code Area). If these blocks are added without specifying an input, the boolean and reporter blocks will default to the value of "foo", while the stack blocks will show up without any inputs. In order to get the stack block to show up with an input, the Mutations property must be properly set.
Note input
Note input | |
::ring #fff |
Opcode: note
The note input, when selected, displays a piano keyboard, where one can select a note. Returns the note number selected. Used internally as the first input to both play note () for () beats
and beep note () for () secs
.
micro:bit display input
Opcode: matrix
The matrix input, when clicked on, displays a 5x5 grid, where one can make 5x5 pixel art. Returns the binary of the image from left to right, top to bottom. Used internally as the input to display ( v)
.
References
- ↑ https://github.com/scratchfoundation/scratch-vm/blob/7eabcb8/src/blocks/scratch3_control.js#L195-L203
- ↑ https://github.com/LLK/scratch-flash/blob/2e4a402/src/scratch/ScratchRuntime.as#L1125
- ↑ ericr. (2018-08-16). "Also, hide the WeDo's "play note" block from the palette, because the sound from the WeDo's tiny buzzer is often very quiet or inaudible." https://github.com/scratchfoundation/scratch-vm/pull/1487
- ↑ https://github.com/scratchfoundation/scratch-vm/pull/2060
- ↑ https://github.com/scratchfoundation/scratch-vm/blob/7eabcb8/src/blocks/scratch3_core_example.js#L58-L64
- ↑ https://developers.google.com/blockly/guides/configure/web/toolbox#shadow_blocks
- ↑ Maximouse. (14/3/2021). "It exists because of how Blockly (and thus Scratch) handles block inputs." post:4995803