You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you create a new block named CUSTOM_BLOCK (INPUT 1) and then define another block called CUSTOM_BLOCK (INPUT 2), the first block definition becomes obsolete. Regardless of which instance of the block you use, the second one is always executed.
This happens because, internally, Scratch maps custom blocks to a generic identifier: CUSTOM_BLOCK %s (for block 1) and CUSTOM_BLOCK %s (for block 2), where %s represents an input (and %b represents a boolean). Since both blocks share the same mapping, Scratch cannot distinguish between them, leading it to always execute the most recently defined version.
There are two possible solutions:
Modify scratch-blocks to correctly recognize and obey the internal custom block ID. (Each block currently does have a unique internal ID, it just not being used (you can actually successfully parse a custom block into the editor without specifying its id at all)).
(Probably easier) Prevent users from creating custom blocks that would result in duplicate mappings with an existing block.
The text was updated successfully, but these errors were encountered:
Titanium2099
changed the title
Due to the way that scratch maps custom blocks/procedures blocks with same name and input types override each other
Scratch Custom Block Mapping Causes Name and Input Type Conflicts
Feb 21, 2025
When you create a new block named
CUSTOM_BLOCK (INPUT 1)
and then define another block calledCUSTOM_BLOCK (INPUT 2)
, the first block definition becomes obsolete. Regardless of which instance of the block you use, the second one is always executed.This happens because, internally, Scratch maps custom blocks to a generic identifier:
CUSTOM_BLOCK %s
(for block 1) andCUSTOM_BLOCK %s
(for block 2), where%s
represents an input (and%b
represents a boolean). Since both blocks share the same mapping, Scratch cannot distinguish between them, leading it to always execute the most recently defined version.There are two possible solutions:
scratch-blocks
to correctly recognize and obey the internal custom block ID. (Each block currently does have a unique internal ID, it just not being used (you can actually successfully parse a custom block into the editor without specifying its id at all)).The text was updated successfully, but these errors were encountered: