Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » The Official Guide to the Scratchblocks Plugin
- han614698
- Scratcher
1000+ posts
The Official Guide to the Scratchblocks Plugin
The Official Guide to the Scratchblocks Plugin
Please test out your new scratchblocks skills here, not on this topic.
Note: If you're new to the scratchblocks plugin, I highly recommend you read all of Section 1 first so you do not get confused.
Table of Contents
- Section 1 - How They Work + Tips
- Section 2 - Basic Scratchblocks Syntax
2.1 - Basic Blocks
2.2 - Inputs
2.3 - Other Basic Features
2.4 - Aliases/Subsitutes- Section 3 - Advanced Scatchblocks Syntax
3.1 - Developing New Blocks
3.2 - Insertable Images
3.3 - Other Syntax- Section 4 - Built-In Blocks
Other/Older Topics
- A guide to [Scratchblocks] and other BBCode help by @Techno-CAT (Oct 1, 2014)
- ITopic: Everything you never knew about [scratchblocks]! by @theonlygusti (Oct 5, 2014)
- The Official BBCode Guide 2.0 by @Create-Scratch101
- CURRENT: The Official Guide to the Scratchblocks Plugin by @han614698 (May 15, 2024)
Credits
@Paddle2See for giving me permission here.
@Zydrolic for an image.
@Techno-CAT for a lot of the content (completely rewritten by me).
@theonlygusti for some ideas.
@Create-Scratch101 for inspiration.
@Maximouse for working with me and several others on my main source I used.
Last edited by han614698 (Nov. 6, 2024 22:10:05)
- han614698
- Scratcher
1000+ posts
The Official Guide to the Scratchblocks Plugin
Section 1 - How They Work + Tips
SUBSECTION ONE - BASIC IIDEAS
What are scratchblocks?
Scratchblocks are a plugin on the forums (and on the wiki) where users can embed Scratch blocks into their text using a text based language. This topic will teach you how to write just normal scripts, and even by the end, make super cool custom blocks to show off your skills.
Shortcut
When creating a forum post, there is a toolbar at the top of the text box. You can hover over the button to find a list of built in blocks. You will learn about how to write these without the dropdown, as well as your own custom blocks.
How to Make Scratchblocks Appear
Just like any other BBCode tag, you can use scratchblocks the same - just put a [scratchblocks] tag before your code, and a [/scratchblocks] tag after it.
Automatic Coloring
The scratchblocks parser, which runs your code, looks at your code for specific blocks which are in the List of Blocks. It will then color them accordingly. Section 2 talks about the syntax to write blocks that already exist in the link above.
SUBSECTION TWO - TIPS
If you're new to scratchblocks, read the other sections before reading these tips.TO BE ADDED LATER
Last edited by han614698 (Nov. 6, 2024 19:09:32)
- han614698
- Scratcher
1000+ posts
The Official Guide to the Scratchblocks Plugin
Section 2 - Basic Syntax
SUBSECTION 2.1 - BASIC BLOCKS
Stack BlocksTo display a stack block, all you have to do is type the block text. The parser always defaults to a stack block.producesif on edge, bounceif on edge, bounce
Reporter BlocksTo display a reporter block, you have to type the block text in parentheses.produces(x position)(x position)
Boolean BlocksTo display a boolean block, you have to put the block text between ‘<’ and ‘>’.produces<mouse down?><mouse down?>
C BlocksTo display a C block, you have to type the block text, then a line break, and then ‘end’. Put the code for blocks inside the C between.producesforever
if on edge, bounce
endforever
if on edge, bounce
end
Cap and Hat BlocksTo display a cap or hat block, all you have to do is just type the block text normally, and the parser will parse it as such.produceswhen green flag clicked
delete this clonewhen gf clicked
delete this clone
Custom BlocksTo display a custom block, you have to type your text normally with “define” in front of it.producesdefine previous costumedefine previous costume
SUBSECTION 2.2 - INPUTS
TextTo add a text input to a block, you have to type the text between brackets.producesthink [Hello World!]think [Hello World!]
NumberTo add a number input to a block, you have to type the number between parentheses.produceswait (1) secondswait (1) seconds
Insertable DropdownTo add an insertable dropdown to a block, you have to type the option between parentheses, with a ‘v’ added.producesplay drum (8 v) for (0.25) beatsplay drum (8 v) for (0.25) beats
Uninsertable DropdownTo add an uninsertable dropdown to a block, you have to type the option between brackets, with a ‘v’ added.produceshide variable [my variable v]hide variable [my variable v]
ColorTo add a color input to a block, you have to add the color hex code between brackets.produces<touching color [#aaaaaa]?><touching color [#aaaaaa]?>
SUBSECTION 3.3 - OTHER BASIC FEATURES
CommentsTo add a comment to a block, you have to add two slashes followed by the comment.producesmove (10) steps//This is a comment.move (10) steps//This is a comment.
PlaceholderTo add a placeholder block, you have to add three dots, with or without spaces. (… or . . .)produces. . .
.... . .
...
SUBSECTION 3.4 - SUBSTITUTES
RotationIf you want to use the rotation blocks, you have to type “turn cw () degrees” or “turn right () degrees” or “turn ↻ () degrees” or vice versa depending on the direction desired.producesturn cw () degrees OR turn right () degrees OR turn ↻ () degrees
turn ccw () degrees OR turn left () degrees OR turn ↺ () degreesturn cw () degrees
turn ccw () degrees
Green FlagIf you want to shorthand type the “when green flag clicked” block, you can type “when gf clicked” or “when flag clicked” or “when ⚑ clicked”.produceswhen gf clicked OR when flag clicked OR when ⚑ clickedwhen gf clicked
Last edited by han614698 (Nov. 8, 2024 15:58:14)
- han614698
- Scratcher
1000+ posts
The Official Guide to the Scratchblocks Plugin
Section 3 - Advanced Syntax
SUBSECTION 3.1 - DEVELOPING NEW BLOCKS
Custom ColoringTo create custom coloring on a block, you must add a preset color or hex code after the block.
The preset colors available are the following:
- motion
- looks
- sound
- pen
- variables
- list
- events
- control
- sensing
- operators
- custom
- custom-arg
- extension
- grey
- obsolete
producescool new block::extensioncool new block::extension
Custom ShapesIn order to create custom shapes, you have to put one of the below types of block after two colons (::).
- hat
- stack
- ring
- boolean
- reporter
- cap
- cat
produceswhen green flag clicked::catwhen green flag clicked::cat
Custom Extension BlocksIn order to create custom extension blocks, you have to put one of the below types of block after two colons (::).
- music
- pen
- video
- tts OR text2speech
- translate
- wedo OR wedo2
- ev3
- microbit
- makeymakey
- gdxfor
- boost
produceswhen green flag clicked::makeymakeywhen green flag clicked::makeymakey
Stacking Custom Colors and BlocksIf you want to have a custom shape and color of a block, you can stack the two above properties.produceswhen project ends::grey reporterwhen project ends::grey reporter
Custom CTo create a custom C block, you have to use curly brackets to separate the lines.producesrepeat (forever v) {
move (10) blocks
} and ever::controlrepeat (forever v){
move (10) steps
}and ever::control
SUBSECTION 3.2 - INSERTABLE IMAGES
Green FlagIf you want to add a Green Flag to a block, you have to type the code @greenFlag.produces<@greenFlag clicked?::events><@greenFlag clicked?::events>
Stop SignIf you want to add a Stop Sign to a block, you have to type the code @stopSign.produces<@stopSign clicked?::events><@stopSign clicked?::events>
Input Addition and DeletionIf you want to add the symbol to delete and add inputs to a block, you have to type the codes @delInput or @addInput.producescreate variable [foo] [bar] @delInput @addInput::variablescreate variable [foo] [bar] @delInput @addInput::variables
Turning Clockwise and CounterclockwiseIf you want to add the symbol to turn counterclockwise and clockwise to a block, you have to type the codes @turnRight or @turnLeft.producesturn @turnRight (20) degrees and then @turnLeft (40) degrees::motionturn @turnRight (20) degrees and then @turnLeft (40) degrees::motion
Loop ArrowIf you want to add a loop arrow to a block, you have to type the code @loopArrow.producesif <[1]=[1]> then repeat (10){
. . .
} @loopArrow::controlif <[1]=[1]> then repeat (10){
. . .
} @loopArrow::control
List ArrayIf you want to add a list symbol to a block, as used in Snap! you have to type the code @list.producesadd to @list [1 v]::listadd to @list [1 v]::list
SUBSECTION 3.3 - OTHER SYNTAX
Cancel the next characterIf you want to cancel the next character, use a backslash. For example, if you want to put a bracket in a text input without ending the text input, you can put a backslash before it.producessay [[text]]say [[text]]which isn't the expected behavior, soproducessay [[text\]]say [[text\]]which is more desired.
Strikethrough BlocksBy adding a hyphen before a block, you can strikethrough the entire block.produces-move (10) steps-move (10) steps
Selected BlocksBy adding a plus before a block, you can put a black outline around (or select) the entire block.producesmove (10) steps
+move (10) steps
move (10) stepsmove (10) steps
+move (10) steps
move (10) steps
Last edited by han614698 (Nov. 8, 2024 16:02:19)
- han614698
- Scratcher
1000+ posts
The Official Guide to the Scratchblocks Plugin
Built-In Blocks
temporarily removed
Last edited by han614698 (Nov. 6, 2024 19:40:40)
- han614698
- Scratcher
1000+ posts
The Official Guide to the Scratchblocks Plugin
I am for sure looking for feedback on this.
- Create-Scratch101
- Scratcher
500+ posts
The Official Guide to the Scratchblocks Plugin
Dude! This is GREAT!!! ))))))
- tristan54mdr
- Scratcher
6 posts
The Official Guide to the Scratchblocks Plugin
not sure how this works but looks nice, you should've putten hard-work into this!
- Create-Scratch101
- Scratcher
500+ posts
The Official Guide to the Scratchblocks Plugin
Do you think you could like the BBCode help one I made? Mine is in QaS, so it won’t be as seen as yours (which is in HwS)
- han614698
- Scratcher
1000+ posts
The Official Guide to the Scratchblocks Plugin
I have no objections to this but where do you think would be a good spot? Do you think you could like the BBCode help one I made? Mine is in QaS, so it won’t be as seen as yours (which is in HwS)
- Create-Scratch101
- Scratcher
500+ posts
The Official Guide to the Scratchblocks Plugin
I have no objections to this but where do you think would be a good spot? Do you think you could like the BBCode help one I made? Mine is in QaS, so it won’t be as seen as yours (which is in HwS)
Maybe change “other, older topics” to “other/older topics”
- godzglaalaa
- New Scratcher
0 posts
The Official Guide to the Scratchblocks Plugin
i am coming for your soul...::#999999 hat
say(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
- LynnSncks
- Scratcher
1 post
The Official Guide to the Scratchblocks Plugin
How do you make a button work if the answer is shown
- Create-Scratch101
- Scratcher
500+ posts
The Official Guide to the Scratchblocks Plugin
i am coming for your soul...::#999999 hat
say(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
Please don’t test your ScratchBlocks Here!
- kittenclaw1
- Scratcher
19 posts
The Official Guide to the Scratchblocks Plugin
i am coming for your soul...::#999999 hat
say(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
define [no]
Last edited by kittenclaw1 (May 26, 2024 03:04:06)
- kittenclaw1
- Scratcher
19 posts
The Official Guide to the Scratchblocks Plugin
define (this is cool)
Last edited by kittenclaw1 (May 26, 2024 03:05:10)
- DarthTater85
- Scratcher
26 posts
The Official Guide to the Scratchblocks Plugin
when green flag clickedOK!!!
say [what]
pen down
play sound [recording1 v]
repeat (99)
jahaah
move (100) steps
end
We need you
You will eat pizza if you want tohttps://scratch.mit.edu
Thin j in goddog
Last edited by DarthTater85 (June 13, 2024 17:04:14)
- DarthTater85
- Scratcher
26 posts
The Official Guide to the Scratchblocks Plugin
z²+c
Last edited by DarthTater85 (May 26, 2024 20:59:47)
- Mazeman4
- Scratcher
61 posts
The Official Guide to the Scratchblocks Plugin
Hey is it possible to add comments to a define block?
//I want to add this
define to this
define but it gives me //this?