Discuss Scratch

GyroscopeBill
Scratcher
500+ posts

ITopic: Everything you never knew about [scratchblocks]!

when this topic read :: events hat
say [excellent guide!] for (2) secs
didn't know you could do this :: operators ring
or {this :: sensing stack} :: custom-arg stack

Pingu is learning about politics with this amazing project.
ninjagolloyd
Scratcher
500+ posts

ITopic: Everything you never knew about [scratchblocks]!

when I read this topic ::hat
{I didnt know about ::operators}
{{{{{{{{{{{{{{{this}}}}}}}}}}}}}}}
or ::reporter sensing
{this {ring ::operators}::ring}
or :: boolean pen
end ::boolean motion
say {thanks ::list}

Last edited by ninjagolloyd (Oct. 12, 2014 10:59:02)


bean
theonlygusti
Scratcher
1000+ posts

ITopic: Everything you never knew about [scratchblocks]!

Rings.

RPFluffy
Scratcher
1000+ posts

ITopic: Everything you never knew about [scratchblocks]!

ninjagolloyd wrote:

when I read this topic ::hat
{I didnt know about ::operators}
{{{{{{{{{{{{{{{this}}}}}}}}}}}}}}}
or ::reporter sensing
{this {ring ::operators}::ring}
or :: boolean pen
end ::boolean motion
say {thanks ::list}
Please try to keep scratch block testing in the official topic!

Nothing Is EVER 100%, that is just an assumption.















Some important links: Here and here or need help click Here. Eats followers, Loves helping people.
My “..” and “…” are not spelling mistakes, it means that they are ways of telling someone that I can continue more about it and that the sentence isn't ended the best way. I like putting new indents and lines so I can split up what I am talking about.




































Some important links: Here and here or need help click Here. Eats followers, Loves helping people. Check this MMO out! Kiwi = Support WHAT THAT'S IMPOSSIBLE: Through the drop down ;)
if <> :: control cstart

else :: control
end
MegaApuTurkUltra
Scratcher
1000+ posts

ITopic: Everything you never knew about [scratchblocks]!

RPFluffy wrote:

ninjagolloyd wrote:

when I read this topic ::hat
{I didnt know about ::operators}
{{{{{{{{{{{{{{{this}}}}}}}}}}}}}}}
or ::reporter sensing
{this {ring ::operators}::ring}
or :: boolean pen
end ::boolean motion
say {thanks ::list}
Please try to keep scratch block testing in the official topic!
I'm pretty sure it's OK. It's not testing, and this topic is about advanced SB2 features.

$(".box-head")[0].textContent = "committing AT crimes since $whenever"
stickfiregames
Scratcher
1000+ posts

ITopic: Everything you never knew about [scratchblocks]!

So ring is not really a block shape, but a modifier for other block shapes?

Because
{ring hat :: events} :: grey ring hat
{ring stack :: motion} :: grey ring stack
{ring cap :: control} :: grey ring cap
{ring reporter :: operators} :: grey ring reporter
are all different. Or is this just a side effect of having all types available in the plugin?










If you can read this, my signature cubeupload has been eaten by an evil kumquat!




or you just used Inspect Element, you hacker

;
VMan_2002
Scratcher
61 posts

ITopic: Everything you never knew about [scratchblocks]!

Well, I guess "ring" is a block shape modifier. :: hat events
[Maybe someone] [forgot v] about [ring being a modifier] :: variables
I don't know. Also, :: cstart control
set [checkthisout v] to [Scratch Cat Geddan]
say (join (join [I made a ] (checkthisout)) [!]
say (join [Go look at my ] (join (checkthisout) [!]))
end
i am cool :: ring variables
look at me :: cap ring list

get [ready v] to {kill [] :: sensing} (item (all v) of [evil kumquats v]) :: events
if <a [evil kumquat v] exists :: sensing>
kill (item (any v) of [evil kumquats v]) :: sensing
end
expect [thanks] from (item (any v) of (people who (had their [signature v] eaten by (item (any v) of [evil kumquats v]):: extension):: sensing)) :: sensing
MyCatInn
Scratcher
7 posts

ITopic: Everything you never knew about [scratchblocks]!



when green flag clicked
clear :: ring
random (4) (x) :: operators
if <[4] > [(5) ]> then
move (say ((4) + {x })) steps
ad (w) <red> [6] [e] {r} (6) <5>
end
go to {} :: hat


[scratchblocks/]
MyCatInn
Scratcher
7 posts

ITopic: Everything you never knew about [scratchblocks]!

{{{<(<(<()>)>)>)}::hat}::hat}::hat}  :: hat
move () steps
MyCatInn
Scratcher
7 posts

ITopic: Everything you never knew about [scratchblocks]!

You can do pricy funny stuff
blob8108
Scratcher
1000+ posts

ITopic: Everything you never knew about [scratchblocks]!

stickfiregames wrote:

So ring is not really a block shape, but a modifier for other block shapes?

blob8108 wrote:

“ring” isn't actually a shape. It does change the shape of the outside of block slightly, but more importantly, it indents blocks embedded inside the ring.

tosh · slowly becoming a grown-up adult and very confused about it
theonlygusti
Scratcher
1000+ posts

ITopic: Everything you never knew about [scratchblocks]!

stickfiregames wrote:

So ring is not really a block shape, but a modifier for other block shapes?

Because
{ring hat :: events} :: grey ring hat
{ring stack :: motion} :: grey ring stack
{ring cap :: control} :: grey ring cap
{ring reporter :: operators} :: grey ring reporter
are all different. Or is this just a side effect of having all types available in the plugin?
Ring is meant for the little grey rings found around scripts in BYOB/Snap! So like this:

run ({pen down :: pen stack}::grey ring) :: control stack

angrybird232
Scratcher
100+ posts

ITopic: Everything you never knew about [scratchblocks]!

hide :: sensing cstart
example 
end

:angrybird232 forum A programer a fake link
example helper



MissSimyLover
Scratcher
31 posts

ITopic: Everything you never knew about [scratchblocks]!

Ducks are COOL

Hello there. Nice to meet you.
I try to speak calmly to you so don't worry.
aaditsayam
Scratcher
61 posts

ITopic: Everything you never knew about [scratchblocks]!

These are all the Control block see
wait () secs
repeat ()
forever

if <> then
wait until <>
repeat until <>
stop [ v]

when I start as a clone
create clone of [ v]
delete this clone

end


end

end


end

AADITSAYAM



I used to just be on the scratch website, Doing random stuff, But now i also go on the forums!


VMan_2002
Scratcher
61 posts

ITopic: Everything you never knew about [scratchblocks]!

theonlygusti wrote:

stickfiregames wrote:

So ring is not really a block shape, but a modifier for other block shapes?

Because
{ring hat :: events} :: grey ring hat
{ring stack :: motion} :: grey ring stack
{ring cap :: control} :: grey ring cap
{ring reporter :: operators} :: grey ring reporter
are all different. Or is this just a side effect of having all types available in the plugin?
Ring is meant for the little grey rings found around scripts in BYOB/Snap! So like this:

run ({pen down :: pen stack}::grey ring) :: control stack
its shadowed. I don't think its supposed to be shadowed.

get [ready v] to {kill [] :: sensing} (item (all v) of [evil kumquats v]) :: events
if <a [evil kumquat v] exists :: sensing>
kill (item (any v) of [evil kumquats v]) :: sensing
end
expect [thanks] from (item (any v) of (people who (had their [signature v] eaten by (item (any v) of [evil kumquats v]):: extension):: sensing)) :: sensing
catsanddogs333
Scratcher
19 posts

ITopic: Everything you never knew about [scratchblocks]!



when green flag clicked
forever



if Stop Sign clicked :: sensing cstart

If [LegoWeDo v] is plugged in then :: grey cstart
forever



Say {Hi my name is {catsanddogs333 :: pen stack } :: list stack } for (5) seconds :: looks

Do the chicken dance until done :: motion
Play movie [Cloudy With A Chance Of Meatballs v] until done :: looks
Play movie [Godzilla VS King Ghidhora v] until done :: looks
Find Pokemon [Articuno v] and try to capture with a [Masterball v] :: operators
end





Thanks for the help! :: grey
Freopt
Scratcher
23 posts

ITopic: Everything you never knew about [scratchblocks]!

aaditsayam wrote:

These are all the Control block see
wait () secs
repeat ()
forever

if <> then
wait until <>
repeat until <>
stop [ v]

when I start as a clone
create clone of [ v]
delete this clone

end



Yes I see so these are all sound blocks see:

play sound [ v]
play sound [ v] until done
stop all sounds
play drum ( v) for (0.2) beats
rest for () beats
play note ( v) for (0.5) 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
change tempo by ()
set tempo to (tempo) bpm


end

end


end
Freopt
Scratcher
23 posts

ITopic: Everything you never knew about [scratchblocks]!

freopt
[/scratcblocks]
Freopt
Scratcher
23 posts

ITopic: Everything you never knew about [scratchblocks]!

theonlygusti wrote:

In this topic, I hope to teach you how to become a [scratchblocks] wizard!

Lots of the cool tricks in scratchblocks aren't easily found anywhere, but they can be really helpful amongst the forums, especially in suggestions, where you sometimes have to make up your own blocks. Scroll right to the bottom to see how to do this.

Now, this tutorial will probably have you itching to try out your new scratchblocks skills, and I don't mind you posting a little bit in this topic to follow along, but once you're done, use the proper testing topic to post all of your scratchblocks wizardry - http://scratch.mit.edu/discuss/topic/14778/

So, firstly:

What is Scratchblocks?

Scratchblocks is a BBCode plugin that allows you to display scripts within the forums.

It is useful for suggestions and help with scripts, because you can show exactly what you mean.

It looks like this:
when gf clicked
say [Hello there!] for (2) secs

How can I use it?

To use the scratchblocks plugin, just put [scratchblocks] and [/scratchblocks] around all of your text.

[scratchblocks]
// all of your scratchblocks scripts go here, in between the tags.
[/scratchblocks]

Simple Scratchblocks

This section will teach you the basics of scratchblocks.

In most blocks, you can just type out all the text that displays on the block, and it will work:

[scratchblocks] hide [/scratchblocks]
will create
 hide 

But this will only work for blocks that have no inputs. If you want to create a block with inputs, you need to put brackets around the input.

Use square brackets, , for strings, and round brackets, (), for numbers:

[scratchblocks]
say [Hello, World!] for (2) secs
[/scratchblocks]

say [Hello, World!] for (2) secs

Notice how I used the different types of bracket?

Now, for a drop down list, you still use brackets, but you have to put a v just before the closing bracket.

Note: you still use round brackets for numbers, and square brackets for strings:

[scratchblocks]
replace item (3 v) of [list v] with [3rd item!]
[/scratchblocks]

replace item (3 v) of [list v] with [3rd item!]

With drop downs, it's important which type of bracket you use to make it appear correctly.

So far we've just looked at stack blocks, and inputs. We'll look at some other blocks later on, but first I'll show you how to put multiple blocks together:

[scratchblocks]
say [Hello!]
hide
add [item] to [list v]
show
point in direction (0 v)
[/scratchblocks]

say [Hello!]
hide
add [item] to [list v]
show
point in direction (0 v)

That's right! It's as easy as putting the next blPCM on the next line!

Now that you've learned some of the basic basics, we can look at c-loops and other shapes:

More complex, yet still basic, block types

For these blocks, you still type exactly what's on the block, but they require some extra knowledge to work properly:

For the green flag block, you can type any of the following:
  1. when green flag clicked
  2. when flag clicked
  3. when gf clicked

I will use the last one though, because it's the shortest one to type, but you can use whichever version you like the most.

[scratchblocks] when gf clicked [/scratchblocks]
when gf clicked

What about some other symbols?

For the turn block, you can type any of the following:
  1. turn cw (15) degrees
  2. turn right (15) degrees
  3. turn ccw (15) degrees
  4. turn left (15) degrees

As you can see, we are replacing the symbol with words.

cw stands for clockwise, and draws an arrow turning clockwise, and ccw means counter-clock wise, and draws an arrow turning counter clock-wise.

Right and cw draw the same arrow, as do left and ccw. It's personal preference which one you use, but I use cw and ccw because they are shorter.
[scratchblocks]
turn cw (15) degrees // could be turn right (15) degrees
turn ccw (15) degrees // could be turn left (15) degrees
[/scratchblocks]

turn cw (15) degrees // could be turn right (15) degrees
turn ccw (15) degrees // could be turn left (15) degrees
But what's this?

In this example you saw how to use a comment, by putting // in front of your comment.

You can make attached comments, and also free-standing comments:
[scratchblocks]
hide // attached comment
// free-standing comment
[/scratchblocks]
hide // attached comment
// free-standing comment

Now, onto c-blocks!

A c-block looks like this:
forever
end

And can be created like this:
[scratchblocks]
forever
end
[/scratchblocks]
notice how you have to write end at the end of your c-block?

NOTE: I indent the blocks inside my c-loops for readability. Normally I don't do this, and it is not necessary.

This is how to tell it where to stop, so you can do:
[scratchblocks]
repeat (2)
hide
end
show
[/scratchblocks]
repeat (2)
hide
end
show
note how the c-block only wraps around the scripts before you write end, and then stops as soon as you write end? This is very useful.

Now, finally, the complex stuff!

In scratchblocks you can force blocks to appear however you want them to, e.g.
using ((seven :: sensing reporter) :: grey reporter) :: variables cstart
end

First, I will teach you how to color your block, in (almost) any way you want.

To do this, you have to learn all the categories of blocks:

  1. events
  2. control
  3. sound
  4. sensing
  5. pen
  6. looks
  7. operators
  8. lists
  9. variables
  10. custom
  11. motion
So, those were all the normal block categories, but there are also some extra ones you can use to color you block:
  • grey
  • extension
  • custom-arg
  • obsolete
Now that you know all the categories, you can color the blocks any way possible.

To do this, you write down your block as normal, but then put two colons, ::, and the name of the category.
[scratchblocks]
set [var v] to (1) // normal
set [var v] to (1) :: motion // as a motion block
[/scratchblocks]

set [var v] to (1) // normal
set [var v] to (1) :: motion // as a motion block
Notice that you can still put comments after you apply your styles.

Now, as well as colors, you can also shape blocks however you want, here are the shapes you will need to know:

  1. stack
  2. hat
  3. cstart
  4. celse
  5. cend
  6. ring
  7. reporter
  8. boolean
  9. cap

You apply shapes in exactly the same way, e.g.
[scratchblocks]show :: hat[/scratchblocks]
show :: hat 

But you can use shapes and colors together, by putting spaces between them:
[scratchblocks]
hide :: sensing cstart
end
[/scratchblocks]
hide :: sensing cstart
end
Notice, that because it is a cstart block, you still need to end it.

You can also end c-loops with cend, here's one of my block ideas and how I created it:
[scratchblocks]
run :: control cstart
without screen refresh :: control cend
[/scratchblocks]

run :: control cstart
without screen refresh :: control cend
Now you know almost as much as me, but not quite:

There is one more type of input, which you put between curly brackets, {}, a block! You can make blocks appear inside other blocks, like this:
[scratchblocks]
this is {a block :: sensing stack} :: custom-arg stack
[/scratchblocks]

this is {a block :: sensing stack} :: custom-arg stack

Notice how I style the block within the brackets? You can do this with all inputs as well, look:

[scratchblocks]
if <true :: operators boolean> then
end
[/scratchblocks]

if <true :: operators boolean> then
end

and now, you're on your way to becoming a true, scratchblocks ninja!

[scratchblocks]
when gf clicked :: operators hat
wait until {this block :: looks} turns purple :: extension cstart
say hi! :: sound stack
and then :: extension celse
use the colors :: custom-arg cstart
to make life :: motion stack
end
finally :: extension cend
stop :: grey cap
[/scratchblocks]
when gf clicked :: operators hat
wait until {this block :: looks} turns purple :: extension cstart
say hi! :: sound stack
and then :: extension celse
use the colors :: custom-arg cstart
to make life :: motion stack
end
finally :: extension cend
stop :: grey cap

Remember, use the proper testing topic to try out scratchblocks: http://scratch.mit.edu/discuss/topic/14778/



These are like HTML <…> tags

Powered by DjangoBB

Standard | Mobile