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.
@Gamerboy1023 for some scratchblocks text that I then didn't have to make myself.

Last edited by han614698 (July 1, 2024 18:28:00)


<Scratch Wikian // 2000+ Edits | Forum Helper // 7000+ Posts | Scratcher // 530+ Followers>


banner coming soon…
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. Here's an example of something you could create (but not in real scratch ):
( ::#000000) ( ::#FFFFFF) ( ::#000000) ( ::#FFFFFF) ( ::#000000) ::motion hat
( ::#FFFFFF) ( ::#000000) ( ::#FFFFFF) ( ::#000000) ( ::#FFFFFF) ::motion
( ::#000000) ( ::#FFFFFF) ( ::#000000) ( ::#FFFFFF) ( ::#000000) ::motion
( ::#FFFFFF) ( ::#000000) ( ::#FFFFFF) ( ::#000000) ( ::#FFFFFF) ::motion cap
Credit to Gamerboy1023
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 (May 17, 2024 01:52:03)


<Scratch Wikian // 2000+ Edits | Forum Helper // 7000+ Posts | Scratcher // 530+ Followers>


banner coming soon…
han614698
Scratcher
1000+ posts

The Official Guide to the Scratchblocks Plugin

Section 2 - Basic Syntax
SUBSECTION ONE - 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’. 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 the normally with “define” in front of it.
define previous costume
produces
define previous costume
SUBSECTION TWO - 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) secs
produces
wait (1) secs
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.
switch costume to [costume1 v]
produces
switch costume to [costume1 v]
Color
To add a color input to a block, you have to add the color hex code between bracket.
<touching color [#aaaaaa]?>
produces
<touching color [#aaaaaa]?>
SUBSECTION THREE - 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 FOUR - SUBSTITUTES
Rotation
If you want to use the rotation blocks, you have to type cw or ccw double depending on the direction. This will not work outside of these two blocks.
turn cw () degrees
turn ccw () 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.
when gf clicked
produces
when gf clicked

Last edited by han614698 (June 27, 2024 02:56:47)


<Scratch Wikian // 2000+ Edits | Forum Helper // 7000+ Posts | Scratcher // 530+ Followers>


banner coming soon…
han614698
Scratcher
1000+ posts

The Official Guide to the Scratchblocks Plugin

Section 3 - Advanced Syntax
SUBSECTION ONE - 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::custom-arg
produces
cool new block::custom-arg
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
when green flag clicked::cap 
produces
when green flag clicked::cap
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 TWO - INSERTABLE IMAGES
Green Flag
If you want to add a Green Flag to a block, you have to type the code @greenFlag.
<@greenFlag clicked?::control>
produces
<@greenFlag clicked?::control>
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
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

Last edited by han614698 (Aug. 17, 2024 20:39:30)


<Scratch Wikian // 2000+ Edits | Forum Helper // 7000+ Posts | Scratcher // 530+ Followers>


banner coming soon…
han614698
Scratcher
1000+ posts

The Official Guide to the Scratchblocks Plugin

Built-In Blocks
move () steps
turn cw () degrees
turn ccw () degrees
point in direction ( v)
point towards [ v]
go to x: () y: (0)
go to [ v]
glide () secs to x: (0) y: (0)
change x by ()
set x to ()
change y by ()
set y to ()
if on edge, bounce
set rotation style [(x position)(y position) v]
change [ v] effect by (25)
set [ v] effect to (0)
clear graphic effects
change size by ()
set size to () %
go to front
go back () layers
(costume #)
(size)
(backdrop name)
play sound [ v]
play sound [ v] until done
stop all sounds
play drum ( v) for (0.25) beats
rest for () beats
play note ( v) for (0.5) beats
set instrument to ( v)
change volume by ()
set volume to (volume) %
change tempo by ()
set tempo to () bpm
clear
stamp
pen down
pen up
set pen color to [#c4296b]
change pen color by ()
set pen color to ()
change pen shade by ()
set pen shade to ()
change pen size by ()
when green flag clicked
when [ v] key pressed
when this sprite clicked
when backdrop switches to [ v]
when [ v] > (10)
when I receive [ v]
broadcast [ v]
broadcast [ v] and wait
wait () secs
repeat ()

end
forever

end
if <> then

end
if <> then

else

end
wait until <>
repeat until <>

end
stop [ v]
when I start as a clone
create clone of [ v]
<touching [ v] ?>
<touching color [#9f7427] ?>
<color [#719e16] is touching [#d34608] ?>
(distance to [ v])
ask [] and wait
(answer)
<key [ v] pressed?>
<mouse down?>
(mouse x)
(mouse y)
(loudness)
(video [ v] on [Stage v])
turn video [ v]
set video transparency to () %
(timer)
reset timer
([ v] of [Sprite1 v])
(current [ v])
(() + (0))
(() - (0))
(() * (0))
(() / (0))
(() - (0))
(pick random () to (10))
<[] < []>
<[] = []>
<[] > []>
<<> and <>>
<<> or <>>
<not <>>
(join [] [world])
(letter () of [world])
(length of [])
(() mod (0))
(round ())
(foo)
(☁ score)
set [ v] to []
change [ v] by (0)
show variable [ v]
hide variable [ v]
(list :: list)
add [] to [list v]
delete ( v) of [list v]
insert [] at (1 v) of [list v]
replace item ( v) of [list v] with [thing]
(item ( v) of [list v] :: list)
(length of [ v] :: list)
<[ v] contains [thing] ?>
show list [ v]
hide list [ v]

Last edited by han614698 (May 16, 2024 00:39:36)


<Scratch Wikian // 2000+ Edits | Forum Helper // 7000+ Posts | Scratcher // 530+ Followers>


banner coming soon…
han614698
Scratcher
1000+ posts

The Official Guide to the Scratchblocks Plugin

I am for sure looking for feedback on this.

<Scratch Wikian // 2000+ Edits | Forum Helper // 7000+ Posts | Scratcher // 530+ Followers>


banner coming soon…
Dagriffpatchfan
Scratcher
500+ posts

The Official Guide to the Scratchblocks Plugin

Hi

I am (probably) Griffpatch's biggest fan, I mean he did comment on my profile!!!!! Please consider checking out my projects such as my SMB4 remake!
Need an image hosted? Click here
If I wrote something, and then you wrote something back, if I don't respond, feel free to send me the topic link and a reminder on my Profile page
Create-Scratch101
Scratcher
100+ posts

The Official Guide to the Scratchblocks Plugin

Dude! This is GREAT!!! ))))))



Don’t see the images? An evil kumquat ate it
tristan54mdr
Scratcher
3 posts

The Official Guide to the Scratchblocks Plugin

not sure how this works but looks nice, you should've putten hard-work into this!

—————————————–IF YOU NEED ANY HELP PLEASE TELL ME THE LINK OF YOUR POST IN MY PROFILE——————————————



Join our Team: The S.S Studio! | Wanna play some Ping-Pong? Try to beat my score!

Let's rush the 100 answers on posts!

Have a great day! ^^

Tristan, France
Create-Scratch101
Scratcher
100+ 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)



Don’t see the images? An evil kumquat ate it
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?

<Scratch Wikian // 2000+ Edits | Forum Helper // 7000+ Posts | Scratcher // 530+ Followers>


banner coming soon…
Create-Scratch101
Scratcher
100+ 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”



Don’t see the images? An evil kumquat ate it
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
100+ 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!



Don’t see the images? An evil kumquat ate it
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.ezproxy.canberra.edu.au
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)

DarthTater85
Scratcher
26 posts

The Official Guide to the Scratchblocks Plugin

I am the best

Powered by DjangoBB