-
Notifications
You must be signed in to change notification settings - Fork 1
Syntax ‐ How to Write in ScratchText
- Hat Blocks
- Stack Blocks
- C Blocks
-
Cap Blocks
- 4.1 Generic C blocks
- 4.2 If-else blocks
- Reporter Blocks
- Values
- Internal Blocks
Hat blocks are blocks that start a stack, and generally are what are used to create code. These blocks contain other blocks below them, creating stacks.
These blocks are used as such:
Hat_name (arguments if any) {
...
}
Stack blocks are what make up the bulk of projects. These are equivalent to what other programming languages call "commands" or "functions". They take (sometimes) arguments in, and do something with them.
These blocks are used as such:
stack_block_name(arguments if any)
C blocks are blocks that contain other blocks inside of them for some processing. C blocks include "if" "forever" and "for" blocks, among many others. They allow you to put blocks inside others, similar to any other programming language.
These blocks are used as such:
c_name (arguments if any) {
...
}
A subset of C blocks, if else blocks are a little special, having 2 ways to write them in ScratchText.
if(condition) {
...
} else {
...
}
if(condition) {
...
}
else {
...
}
Cap blocks are blocks that end a stack off. No blocks can be added underneath them, as they end it. These blocks look similar to stack blocks, and include blocks such as "stop("all scripts")", "deleteClone" and a few others.
These blocks are used as such:
cap_block(arguments if any)
Reporter blocks are blocks that return values, or get values, and can be used as arguments in any block that accepts arguments. For instance, "mouse()" gets the value of the mouse [whether or not it is being currently clicked] and can be used to detect mouse down.
These blocks can be used inside the "input" arguments for any block containing them. They are used as such:
c_name (reporter_name(arguments if any)) {
...
}
hat_name (reporter_name(arguments if any)) {
...
}
stack_block_name (reporter_name(arguments if any))
Values are either a string or number, (both processed the same in Scratch), and are usually used similarly to reporter blocks.
Internal blocks are a block that the program uses internally, and should not be used when writing code. For most purposes, it is safe to ignore these blocks. For those who understand the SB3 json file format on a very deep level, there is potential to make hacked blocks with them.