This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-11-02 20:52:17

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

A Guide to Scratchblocks

Seeing as some scratchers don't know how to make scratchblocks, how others don't know how to make some scratchblocks, and that there really hasn't been a guide to scratchblocks, I decided to make a guide on scratchblocks in general. If you see something that needs to be added/changed, just say.  wink

Content:

Making Scratchblocks

Fixing Scripts

Scratchblock Etiquette

Credits


{|Making Scratchblocks|}

I could give you the code for every scratchblock there is in scratch, but do you know how long that would take to type? Instead, I'll teach you a different way.

To make a scratchblock, put it in between [scratchblocks] [/scratchblocks] tags. Then, type what you would see in Scratch. For example, in scratch, the green flag hat block has "when gf (green flag) clicked", so you would type "when gf clicked".

Now, the one exception to this is the c-blocks (repeat, if, ect.. Excluding forever and forever if.) which you'll have to put "end" where you want the c-block to end. Other than that, there should only be one block per line.

Now into the finer details:
If you want to add a drop down menu, use [ v]. If you want to add a place where you can type, again use ( ) or [ ]. And if you want to add arrows, type cw (clockwise) or ccw (counter-clock wise).

Along with that, if you want to add a colored box, just type a color's HEX code inside [ and ], some of which can be seen here. Also, if you want to leave a comment, use // after a scratchblock and type your comment after the two dashes.

Into conditionals/variables:
Basically, they follow the same rules as above, except variables should have parentheses around them. Also, any block that normally has pointy ends should have < and > surrounding them. Now, your almost done.  smile

The two exceptions:
One exception to all of the above happens to be the "when sprite clicked" hat block. For some reason, you always have to type it as "when [sprite2 v] clicked" when you really should type "when sprite2 clicked" My only tip is to memorize this, which should be easy. The other exception is the "stop all sounds" block which is red no matter what you do, unless you type "stop all pinks".

Anyway, here's a sample code:

when [sprite2 v] clicked
set [pie v] to (98)
if <not <(pie) < (5)>>
 repeat (5)
  turn cw (5) degrees
  say [Pie!] for (5) secs//This is a comment.
 end
end
forever if <touching color [#00FF00]?>
 go to x: (5) y: (4)
 stop all pinks

And this is what I wrote:

Code:

[scratchblocks]
when [sprite2 v] clicked
set [pie v] to (98)
if <not <(pie) < (5)>>
 repeat (5)
  turn cw (5) degrees
  say [Pie!] for (5) secs//This is a comment.
 end
end
forever if <touching color [#00FF00]?>
 go to x: (5) y: (4)
 stop all pinks
[/scratchblocks]

Congradulations on learning how to make scratchblocks!

Remember, if you ever want more practice, you can go here, or if you want to have a program create your code for you, you can go here.

{|Fixing Scripts|}

if (touching [mouse v]?
 if <(mouse)>(5)>
  go to x (5) y (6)
 end
end
Have you ever gotten an if statement like this? Do your scripts always look red when they shouldn't? Well follow these tips and you should be fixing scripts more quickly!

Conditionals:

When looking at a messed up conditional, my first tip is to look at the code and count the parentheses facing left and the ones facing right. You should have an equal amount of both, so if you don't, then that's part of your problem. The same thing should be true with <'s when you're excluding the ones in inequality statements.

Another tip that I have is that if an inequality doesn't seem to be right, then make sure that there is a space between the inequality sign and the two conditions. As seen above in the second if block, spaces weren't included before and after the inequality sign so the script became messed up.

Along with all of that, there are two common mistakes that are often made. Someone might forget to add a question mark, and British colour might be used instead of color, both of which will cause problems in your script. So, when fixing scripts, check those things.

Blocks:

If your scripts are becoming red when they shouldn't, then what might be happening is that you forgot to put a number in parentheses or you forgot a letter. For example, one common problem is that someone might use "seconds" instead of "secs" Another common mistake is that receive might be spelled as recieve. Other than that, problems here can vary greatly, so my next tip is that you could open scratch and compare the text in the actual block with the text in your block, or you could hunt for an example in the Scratchblocks testing area, find an example, quote it and look at the code.

{|Scratchblock Etiquette|}

Posting random scratchblocks in the forums is seen as, well, unnecessary and spamming. It is also frowned upon when you post a post just to test some script, because there's the preview button as well as the Scratchblocks testing area in the Help with Scripts forum to look at your scripts. Another thing that is considered annoying is posting scratchblocks tags before quote tags while having the inner two switched. This is considered annoying because it messes up the the web page as well as every post that follows it, so don't do it.

Now you're asking, If there are all these things not to do, what should I do? Well, what you could do is when you do post a script, try and include several comments as to help explain the purpose of the script. Another thing you could do is that if you see a script with some problems in it, you could quote it and fix it. I often do this as it helps clarify what the script is and it also helps the scratcher learn from their mistakes.

{|Credits|}

Thanks to joefarebrother for pointing out several missing pieces of info!

Thanks to Martiscratch for giving me the link to the HEX color page!

Thanks to awsomeness321 for pointing out what part of joefarebrother's post meant & pointing out two things I could add!

Paddle2See for his amazing scratch program!

Last updated: 1/12/13

Last edited by ErnieParke (2013-01-12 11:30:58)


http://i46.tinypic.com/35ismmc.png

Offline

 

#2 2012-11-03 23:20:57

Dazachi
Retired Community Moderator
Registered: 2009-09-12
Posts: 1000+

Re: A Guide to Scratchblocks

Nice guide!


Dazachi, Retired Community Moderator
May also know me as OJACheung.

Offline

 

#3 2012-11-04 09:03:42

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: A Guide to Scratchblocks

Dazachi wrote:

Nice guide!

Thanks!  big_smile

Anyway, I'm curious, did you find any part of the guide confusing? Is there anything you would like to see added to this guide? Thanks in advance for your feedback!


http://i46.tinypic.com/35ismmc.png

Offline

 

#4 2012-11-04 14:19:39

Borrego6165
Scratcher
Registered: 2011-03-10
Posts: 1000+

Re: A Guide to Scratchblocks

to be honest, I don't think I need to read it. not because I was put off by the start, because it's a topic where you can't really go wrong. Perhaps it's a bit long considering what you're trying to help scratchers do, perhaps you should start with an X-Step Quick Guide, then go into detail and keep everything you've written underneath. oh, and nice guide!  tongue


Generation:4001 Build a beautiful city, with over 50 objects and over 10000 tiles per city! This simulates traffic, pollution, tourism, crime and more!

Offline

 

#5 2012-11-04 14:59:22

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: A Guide to Scratchblocks

Borrego6165 wrote:

to be honest, I don't think I need to read it. not because I was put off by the start, because it's a topic where you can't really go wrong. Perhaps it's a bit long considering what you're trying to help scratchers do, perhaps you should start with an X-Step Quick Guide, then go into detail and keep everything you've written underneath. oh, and nice guide!  tongue

Part of the reason why it's long is due to the fact that I talk about etiquette and fixing scripts, though I agree, the Making Scratchblocks section does seem a bit long. I'll see what I can do. Anyway, thanks for the feedback!


http://i46.tinypic.com/35ismmc.png

Offline

 

#6 2012-11-10 22:25:13

GenChico
Scratcher
Registered: 2012-11-08
Posts: 100+

Re: A Guide to Scratchblocks

Pretty cool guide, helped a lot with understanding the basics of scratch blocks. I would definitely refer people to this If they needed help with scratch blocks.


http://i.imgur.com/Cb8HC.png

Offline

 

#7 2012-11-11 09:23:52

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: A Guide to Scratchblocks

GenChico wrote:

Pretty cool guide, helped a lot with understanding the basics of scratch blocks. I would definitely refer people to this If they needed help with scratch blocks.

Well I'm glad to here that you've fully understood scratchblocks and that you trying to help others do the same thing!  smile


http://i46.tinypic.com/35ismmc.png

Offline

 

#8 2012-11-11 09:49:14

Ideas
Scratcher
Registered: 2012-10-07
Posts: 100+

Re: A Guide to Scratchblocks

Excellent guide, you should add step by step guide to making variables and lists for each varible and list block.

Scratch on.


http://img685.imageshack.us/img685/2010/screenshot20121110at132.pngI think that you must CLICK above

Offline

 

#9 2012-11-11 10:00:41

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: A Guide to Scratchblocks

You should mention that when scratchblocks go red even when they look the same as in scratch, it is usually a missing question mark or the British spelling of colour instead of color. Also mention that the stop all sounds blorck always goes red even when it looks just like the text in scratch is.

Edit: you forgot to mention how to add colours.

Last edited by joefarebrother (2012-11-11 10:02:36)


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#10 2012-11-11 10:15:24

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: A Guide to Scratchblocks

Ideas wrote:

Excellent guide, you should add step by step guide to making variables and lists for each varible and list block.

Scratch on.

Well this guide already covers that; just type what you would see in Scratch. Other than that, thanks!

joefarebrother wrote:

You should mention that when scratchblocks go red even when they look the same as in scratch, [1] it is usually a missing question mark or the British spelling of colour instead of color. [2] Also mention that the stop all sounds blorck always goes red even when it looks just like the text in scratch is.

[3] Edit: you forgot to mention how to add colours.

1). I completely forgot about that, so thanks for reminding me. I'll add that when I have time.

Edit: Added.

2). I never knew about that, or at least I did at one point but I forgot afterwards. I'll add it when I can.

Edit: Added.

3). And what do you mean by adding colours?

Last edited by ErnieParke (2012-11-11 11:24:38)


http://i46.tinypic.com/35ismmc.png

Offline

 

#11 2012-11-11 10:33:13

awesomeness321
Scratcher
Registered: 2012-08-10
Posts: 100+

Re: A Guide to Scratchblocks

ErnieParke wrote:

Ideas wrote:

Excellent guide, you should add step by step guide to making variables and lists for each varible and list block.

Scratch on.

Well this guide already covers that; just type what you would see in Scratch. Other than that, thanks!

joefarebrother wrote:

You should mention that when scratchblocks go red even when they look the same as in scratch, [1] it is usually a missing question mark or the British spelling of colour instead of color. [2] Also mention that the stop all sounds blorck always goes red even when it looks just like the text in scratch is.

[3] Edit: you forgot to mention how to add colours.

1). I completely forgot about that, so thanks for reminding me. I'll add that when I have time.

2). I never knew about that, or at least I did at one point but I forgot afterwards. I'll add it when I can.

Edit: Added.

3). And what do you mean by adding colours?

3. He means, for example:

<touching color [#FF0000]?>
is

Code:

 <blah blah [#FF0000]?>

My newest project:http://blocks.scratchr.org/API.php?user=awesomeness321&amp;action=projects&amp;type=newest&amp;return=image&amp;num=1Color:#30F9A5 I am currently http://blocks.scratchr.org/API.php?user=awesomeness321&amp;action=onlineStatus&amp;type=text

Offline

 

#12 2012-11-11 11:07:24

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: A Guide to Scratchblocks

awesomeness321 wrote:

ErnieParke wrote:

Ideas wrote:

Excellent guide, you should add step by step guide to making variables and lists for each varible and list block.

Scratch on.

Well this guide already covers that; just type what you would see in Scratch. Other than that, thanks!

joefarebrother wrote:

You should mention that when scratchblocks go red even when they look the same as in scratch, [1] it is usually a missing question mark or the British spelling of colour instead of color. [2] Also mention that the stop all sounds blorck always goes red even when it looks just like the text in scratch is.

[3] Edit: you forgot to mention how to add colours.

1). I completely forgot about that, so thanks for reminding me. I'll add that when I have time.

Edit: Added.

2). I never knew about that, or at least I did at one point but I forgot afterwards. I'll add it when I can.

Edit: Added.

3). And what do you mean by adding colours?

3. He means, for example:

<touching color [#FF0000]?>
is

Code:

 <blah blah [#FF0000]?>

Oh... I'll add that.

Edit: Added.

Last edited by ErnieParke (2012-11-11 11:25:03)


http://i46.tinypic.com/35ismmc.png

Offline

 

#13 2012-11-11 11:50:38

Martiscratch
Scratcher
Registered: 2012-05-04
Posts: 100+

Re: A Guide to Scratchblocks

btw,If you want other colours use this.


http://signaturecraft.us/signatures/eJw1yDEOgCAMBdC9p_gnICphdnA18QwoNZIAJRTD9Z184-uP74gKjxIvxi3tzaii3ZA-PjPijdgxvBpjcCYeeOtKW2Ou3OhIAbuUIOUvpdnNtDhH1tL0AQVCHgk~.png

Offline

 

#14 2012-11-11 11:58:23

Gravitation
New Scratcher
Registered: 2012-09-26
Posts: 500+

Re: A Guide to Scratchblocks

Martiscratch wrote:

btw,If you want other colours use this.

Either that or you can use the color picker in Gimp, write your own (strongly recommended  tongue ), or use http://www.2createawebsite.com/build/hex-colors.html

Offline

 

#15 2012-11-11 12:00:25

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: A Guide to Scratchblocks

Martiscratch wrote:

btw,If you want other colours use this.

I didn't even know about that, and I really like the program, so I'll use that link instead. Thanks!


http://i46.tinypic.com/35ismmc.png

Offline

 

#16 2012-11-11 12:09:46

awesomeness321
Scratcher
Registered: 2012-08-10
Posts: 100+

Re: A Guide to Scratchblocks

ErnieParke wrote:

"stop all sounds" block which is red no matter what you do.

Actually,



stop all sounds//This doesn't work. Instead, use:
stop all pinks//This is what works.
tongue


My newest project:http://blocks.scratchr.org/API.php?user=awesomeness321&amp;action=projects&amp;type=newest&amp;return=image&amp;num=1Color:#30F9A5 I am currently http://blocks.scratchr.org/API.php?user=awesomeness321&amp;action=onlineStatus&amp;type=text

Offline

 

#17 2012-11-11 12:11:52

Gravitation
New Scratcher
Registered: 2012-09-26
Posts: 500+

Re: A Guide to Scratchblocks

awesomeness321 wrote:

ErnieParke wrote:

"stop all sounds" block which is red no matter what you do.

Actually,



stop all sounds//This doesn't work. Instead, use:
stop all pinks//This is what works.
tongue

Yeah, EP knows, but technically that's not "stop all sounds".

Offline

 

#18 2012-11-11 12:13:56

awesomeness321
Scratcher
Registered: 2012-08-10
Posts: 100+

Re: A Guide to Scratchblocks

Gravitation wrote:

awesomeness321 wrote:

ErnieParke wrote:

"stop all sounds" block which is red no matter what you do.

Actually,



stop all sounds//This doesn't work. Instead, use:
stop all pinks//This is what works.
tongue

Yeah, EP knows, but technically that's not "stop all sounds".

Well, he should at least mention it.


My newest project:http://blocks.scratchr.org/API.php?user=awesomeness321&amp;action=projects&amp;type=newest&amp;return=image&amp;num=1Color:#30F9A5 I am currently http://blocks.scratchr.org/API.php?user=awesomeness321&amp;action=onlineStatus&amp;type=text

Offline

 

#19 2012-11-11 13:57:31

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: A Guide to Scratchblocks

awesomeness321 wrote:

Gravitation wrote:

awesomeness321 wrote:

Actually,



stop all sounds//This doesn't work. Instead, use:
stop all pinks//This is what works.
tongue

Yeah, EP knows, but technically that's not "stop all sounds".

Well, he should at least mention it.

If you look again, you'll see that I added it. I think that it's nice to know, even though it's not going to be used very often. Also, you could get a lugh or two from it.

Last edited by ErnieParke (2012-11-11 14:05:51)


http://i46.tinypic.com/35ismmc.png

Offline

 

#20 2012-11-12 18:01:51

awesomeness321
Scratcher
Registered: 2012-08-10
Posts: 100+

Re: A Guide to Scratchblocks

Another thing:

Many people type:

say [whatever] for (2) seconds
So you should explain that you need to type 'secs' instead of 'seconds'.


My newest project:http://blocks.scratchr.org/API.php?user=awesomeness321&amp;action=projects&amp;type=newest&amp;return=image&amp;num=1Color:#30F9A5 I am currently http://blocks.scratchr.org/API.php?user=awesomeness321&amp;action=onlineStatus&amp;type=text

Offline

 

#21 2012-11-12 18:38:42

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: A Guide to Scratchblocks

awesomeness321 wrote:

Another thing:

Many people type:

say [whatever] for (2) seconds
So you should explain that you need to type 'secs' instead of 'seconds'.

I should have added that, but I hadn't, so thanks for pointing this out! If you look above again, you'll see that I added it.


http://i46.tinypic.com/35ismmc.png

Offline

 

#22 2013-04-02 05:04:21

warlordx2
Scratcher
Registered: 2013-02-22
Posts: 30

Re: A Guide to Scratchblocks

ErnieParke wrote:

awesomeness321 wrote:

Gravitation wrote:


Yeah, EP knows, but technically that's not "stop all sounds".

Well, he should at least mention it.

If you look again, you'll see that I added it. I think that it's nice to know, even though it's not going to be used very often. Also, you could get a lugh or two from it.

but the problem is that

stop all pinks
is'ent a real block!  neutral


smile   neutral   sad    big_smile   yikes   wink   hmm   tongue   lol   mad   roll   cool  bye!

Offline

 

#23 2013-04-02 05:06:49

warlordx2
Scratcher
Registered: 2013-02-22
Posts: 30

Re: A Guide to Scratchblocks

say [great guide] for (2) secs
stop all


smile   neutral   sad    big_smile   yikes   wink   hmm   tongue   lol   mad   roll   cool  bye!

Offline

 

#24 2013-04-02 06:14:12

topazdragonlord
Scratcher
Registered: 2013-02-22
Posts: 500+

Re: A Guide to Scratchblocks

awesome post really helped a lot  smile


http://i45.tinypic.com/idumbk.png

Offline

 

#25 2013-04-08 04:37:33

GiorgosKarvelas365
New Scratcher
Registered: 2013-03-01
Posts: 37

Re: A Guide to Scratchblocks

stop all pinks
motion on
reset timer
add (volume) to [scratchblocks v]
set tempo to <(HP or (Timer)>
stop all

Offline

 

Board footer