Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » definition
- Knight_In_Armor
-
100+ posts
definition
Hello! A definition, or a custom block as some call it, is a feature that allows you to create your own blocks, with other blocks, and somehow shortens your code. For example, if you are making a game where Scratch Cat says something and dances more than once, instead of:
You can replace it using definitions like this:
So basically, it acts as creating a new block, and then using that block. Hope I helped! Please follow, like and fav!
You can replace it using definitions like this:
So basically, it acts as creating a new block, and then using that block. Hope I helped! Please follow, like and fav!

- footsocktoe
-
1000+ posts
definition
how do you use definition and when would you need it?
Most of the time people use them it is not because they NEED to use them (although sometimes it is).
I use them to make my scripts easier for me to read.
Simple example: https://scratch.mit.edu/projects/151991854/
- Capci360
-
9 posts
definition
thanks those really helped
my programs will be a load easier for me to read 


- deenfoxx
-
100+ posts
definition
how do you use definition and when would you need it?
I'm surprised no one mentioned the fact that a custom block is the ONLY way you can set a specific sequence of blocks to execute without refreshing the screen. This is how you achieve turbo speeds of complex pen drawing and collision detection routines without drawing anything to the screen until after you are done with the code. I think that is what footsocktoe meant by people NEEDing to use them.
A good example can be found at this project someone else created…
https://scratch.mit.edu/projects/151078973/
Notice how when you start it draws the grass in the background (very slowly).
Here is mine with a simple addition of a custom block “drawSceneQuickly” set to “Run without screen refresh”.
https://scratch.mit.edu/projects/154371885/
- Discussion Forums
- » Help with Scripts
-
» definition