Discuss Scratch

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
Other/Older Topics
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 Blocks
To display a stack block, all you have to do is type the block text. The parser always defaults to a stack block.
if on edge, bounce
produces
if on edge, bounce
Reporter Blocks
To display a reporter block, you have to type the block text in parentheses.
(x position)
produces
(x position)
Boolean Blocks
To display a boolean block, you have to put the block text between ‘<’ and ‘>’.
<mouse down?>
produces
<mouse down?>
C Blocks
To 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.
forever
if on edge, bounce
end
produces
forever
if on edge, bounce
end
Cap and Hat Blocks
To 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.
when green flag clicked
delete this clone
produces
when gf clicked
delete this clone
Custom Blocks
To display a custom block, you have to type your text normally with “define” in front of it.
define previous costume
produces
define previous costume
SUBSECTION 2.2 - INPUTS
Text
To add a text input to a block, you have to type the text between brackets.
think [Hello World!]
produces
think [Hello World!]
Number
To add a number input to a block, you have to type the number between parentheses.
wait (1) seconds
produces
wait (1) seconds
Insertable Dropdown
To add an insertable dropdown to a block, you have to type the option between parentheses, with a ‘v’ added.
play drum (8 v) for (0.25) beats
produces
play drum (8 v) for (0.25) beats
Uninsertable Dropdown
To add an uninsertable dropdown to a block, you have to type the option between brackets, with a ‘v’ added.
hide variable [my variable v]
produces
hide variable [my variable v] 
Color
To add a color input to a block, you have to add the color hex code between brackets.
<touching color [#aaaaaa]?>
produces
<touching color [#aaaaaa]?>
SUBSECTION 3.3 - OTHER BASIC FEATURES
Comments
To add a comment to a block, you have to add two slashes followed by the comment.
move (10) steps//This is a comment.
produces
move (10) steps//This is a comment.
Placeholder
To add a placeholder block, you have to add three dots, with or without spaces. (… or . . .)
. . .
...
produces
. . .
...
SUBSECTION 3.4 - SUBSTITUTES
Rotation
If 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.
turn cw () degrees     OR     turn right () degrees     OR     turn ↻ () degrees
turn ccw () degrees OR turn left () degrees OR turn ↺ () degrees
produces
turn cw () degrees
turn ccw () degrees
Green Flag
If you want to shorthand type the “when green flag clicked” block, you can type “when gf clicked” or “when flag clicked” or “when ⚑ clicked”.
when gf clicked     OR     when flag clicked     OR     when ⚑ clicked
produces
when 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 Coloring
To 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
cool new block::extension
produces
cool new block::extension
Custom Shapes
In 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
when green flag clicked::cat
produces
when green flag clicked::cat
Custom Extension Blocks
In 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
when green flag clicked::makeymakey
produces
when green flag clicked::makeymakey
Stacking Custom Colors and Blocks
If you want to have a custom shape and color of a block, you can stack the two above properties.
when project ends::grey reporter
produces
when project ends::grey reporter
Custom C
To create a custom C block, you have to use curly brackets to separate the lines.
repeat (forever v) {
move (10) blocks
} and ever::control
produces
repeat (forever v){
move (10) steps
}and ever::control
SUBSECTION 3.2 - INSERTABLE IMAGES
Green Flag
If you want to add a Green Flag to a block, you have to type the code @greenFlag.
<@greenFlag clicked?::events>
produces
<@greenFlag clicked?::events>
Stop Sign
If you want to add a Stop Sign to a block, you have to type the code @stopSign.
<@stopSign clicked?::events>
produces
<@stopSign clicked?::events>
Input Addition and Deletion
If you want to add the symbol to delete and add inputs to a block, you have to type the codes @delInput or @addInput.
create variable [foo] [bar] @delInput @addInput::variables
produces
create variable [foo] [bar] @delInput @addInput::variables
Turning Clockwise and Counterclockwise
If you want to add the symbol to turn counterclockwise and clockwise to a block, you have to type the codes @turnRight or @turnLeft.
turn @turnRight (20) degrees and then @turnLeft (40) degrees::motion
produces
turn @turnRight (20) degrees and then @turnLeft (40) degrees::motion
Loop Arrow
If you want to add a loop arrow to a block, you have to type the code @loopArrow.
if <[1]=[1]> then repeat (10){ 
. . .
} @loopArrow::control
produces
if <[1]=[1]> then repeat (10){ 
. . .
} @loopArrow::control
List Array
If you want to add a list symbol to a block, as used in Snap! you have to type the code @list.
add to @list [1 v]::list
produces
add to @list [1 v]::list
SUBSECTION 3.3 - OTHER SYNTAX
Cancel the next character
If 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.
say [[text]] 
produces
say [[text]]
which isn't the expected behavior, so
say [[text\]]
produces
say [[text\]]
which is more desired.
Strikethrough Blocks
By adding a hyphen before a block, you can strikethrough the entire block.
-move (10) steps
produces
-move (10) steps
Selected Blocks
By adding a plus before a block, you can put a black outline around (or select) the entire block.
move (10) steps
+move (10) steps
move (10) steps
produces
move (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.
Dagriffpatchfan
Scratcher
1000+ posts

The Official Guide to the Scratchblocks Plugin

Hi
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

Create-Scratch101 wrote:

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)
I have no objections to this but where do you think would be a good spot?
Create-Scratch101
Scratcher
500+ posts

The Official Guide to the Scratchblocks Plugin

han614698 wrote:

Create-Scratch101 wrote:

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)
I have no objections to this but where do you think would be a good spot?

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

godzglaalaa wrote:

 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

godzglaalaa wrote:

 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 clicked
say [what]
pen down
play sound [recording1 v]
repeat (99)
jahaah
move (100) steps
end
OK!!!
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?

Powered by DjangoBB