Discuss Scratch

dude341
Scratcher
1000+ posts

ITopic: Everything you never knew about [scratchblocks]!

avivstru wrote:

sorry for asking, but what is the use of the ring form?
please tell me if you know::ring
The ring is used in a Scratch mod called BYOB. They look different on the forums unless you use them in the right way. Don't forget, they are not similar to a boolean or reporter!

Placeholder
snaps1
Scratcher
66 posts

ITopic: Everything you never knew about [scratchblocks]!

theonlygusti wrote:

MegaApuTurkUltra wrote:

cool tutorial::custom hat
>>>::cstart list
didn't know about these: {sup (derp::stack operators)::variables ring}:: sensing // lol glitch
or this::celse motion
but I knew about everything else!::celse
so good job::cend cap
Thanks!
when green flag clicked[quote=ChocolatePi][scratchblocks]
when green flag clicked :: motion
say { ninja! } :: sensing
think {say [sorry for blockspam ] :: variables }
set { but this is so :: motion } to (fun)
[/quote]

[/scratchblocks][scratchblocks]


when ( v) clicked :: events hat
my dream mod hat. make it.

Last edited by snaps1 (April 12, 2015 13:04:48)


Just Rolling Around!

( [roll v] and [laugh v])
;
NNNPPPBBB
Scratcher
100+ posts

ITopic: Everything you never knew about [scratchblocks]!

snaps1 wrote:

theonlygusti wrote:

MegaApuTurkUltra wrote:

cool tutorial::custom hat
>>>::cstart list
didn't know about these: {sup (derp::stack operators)::variables ring}:: sensing // lol glitch
or this::celse motion
but I knew about everything else!::celse
so good job::cend cap
Thanks!
when green flag clicked[quote=ChocolatePi][scratchblocks]
when green flag clicked :: motion
say { ninja! } :: sensing
think {say [sorry for blockspam ] :: variables }
set { but this is so :: motion } to (fun)
[/quote]

[/scratchblocks][scratchblocks]


when ( v) clicked :: events hat
my dream mod hat. make it.
[/quote]




Do you mean...
[scratchblocks]
when [ v] clicked::events hat
[/scratchblocks]

Last edited by NNNPPPBBB (April 12, 2015 13:08:24)


does your word mind want a challenge? click here.
black link
Hello I am NNNPPAAAAAAAAUUUGGGHHHH MY SIGNATURE'S BEING EATEN BY A KUMQ—
{the sound of silence}

;
ScratchStarShip
Scratcher
27 posts

ITopic: Everything you never knew about [scratchblocks]!

test
avivstru
Scratcher
31 posts

ITopic: Everything you never knew about [scratchblocks]!

dude341 wrote:

avivstru wrote:

sorry for asking, but what is the use of the ring form?
please tell me if you know::ring
The ring is used in a Scratch mod called BYOB. They look different on the forums unless you use them in the right way. Don't forget, they are not similar to a boolean or reporter!
thank you! I know BYOB (or Snap!). the rings are best inside blocks. for example (with another BYOB block ):
list ({hide}►::grey ring) ◄►::list reporter
link to the ariticle about BYOB in the wiki:
http://wiki.scratch.mit.edu/wiki/BYOB_(Scratch_Modification)
the cloud version's url (I couldn't make a link):
http://snap.berkeley.edu/run

Support the split block and make cloud games easier to make for us all! (by tymewalk)
Visit my remake of Google's Dinosaur runner Easter Egg when disconnected from the internet!
Visit the project of my signature social experiment - The Hot Potato!
And visit the profiles of the Scratchers I follow:
TheAmazinRobot , jackkohav, maormosheker, idodyle and yynn!
/        ◔\::variables cstart
//Nooo! Evil nasty scratchblocks-style kumquat had ate my signature!
dude341
Scratcher
1000+ posts

ITopic: Everything you never knew about [scratchblocks]!

text [ ] with exceptions {[bold v] ::grey ring} ::extension //No, you know nothing about SCRATCHBLOCKS!

Last edited by dude341 (April 14, 2015 13:58:46)


Placeholder
avivstru
Scratcher
31 posts

ITopic: Everything you never knew about [scratchblocks]!

text [] with exceptions {[bold v]::grey ring}::extension//no, I know SOMETHING about SCRATCHBLOCKS!
text [] with exceptions {[italics v]::grey ring}::extension
fancy text

Support the split block and make cloud games easier to make for us all! (by tymewalk)
Visit my remake of Google's Dinosaur runner Easter Egg when disconnected from the internet!
Visit the project of my signature social experiment - The Hot Potato!
And visit the profiles of the Scratchers I follow:
TheAmazinRobot , jackkohav, maormosheker, idodyle and yynn!
/        ◔\::variables cstart
//Nooo! Evil nasty scratchblocks-style kumquat had ate my signature!
snaps1
Scratcher
66 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 was created by the scratch user blob8108 and implemented by nXIII.

It is useful for suggestions and within the help with scripts forums, because you can show exactly what you mean:

when gf clicked
say [Hello there!] for (2) secs

But you have to remember not to spam with it! Only use it when necessary, never write an entire post in nothing but scratchblocks.

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 text, 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 (42 v) of [Numbers v] with [The answer!]
[/scratchblocks]

replace item (42 v) of [Numbers v] with [The answer!]

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

So far we've looked at stack blocks, and inputs. You can create other blocks as well, 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 block on the next line!

Now that you've learned some of the basic basics, we can look at c-blocks, symbols 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:
  • when green flag clicked
  • when flag clicked
  • 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:
  • turn cw (15) degrees
  • turn right (15) degrees
  • turn ccw (15) degrees
  • 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 two forward-slashes, //, 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.

You create if-else blocks in a similar fashion,

[scratchblocks]
if <((2) + (2)) = [5]> then
say [Freedom is slavery.]
else
say [Peace is war.]
end
[/scratchblocks]

if <((2) + (2)) = [5]> then
say [Freedom is slavery.]
else
say [Peace is war.]
end

But wait! What's this? A new block!

Predicates are the diamond-shaped blocks within scratch, sometimes called booleans. In scratchblocks, they are created with the < and > symbols, but they only display as round:

[scratchblocks]
wait until <mouse down?>
[/scratchblocks]

wait until <mouse down?>

And reporters, the round blocks, are made using normal brackets, ():

[scratchblocks]
wait ([sin v] of (90)) secs
[/scratchblocks]

wait ([sin v] of (90)) secs

To use variables in scratchblocks, you literally just write the name of the variable within brackets:

[scratchblocks]
change y by (gravity)
[/scratchblocks]

change y by (gravity)

And when it comes to custom blocks, scratchblocks becomes really clever; it remembers which names were arguments and which were not!

[scratchblocks]
define square (width)
pen down
repeat (4)
move (width) steps
turn cw (90) degrees
end
pen up
[/scratchblocks]

define square (width)
pen down
repeat (4)
move (width) steps
turn cw (90) degrees
end
pen up

Now, finally, the complex stuff!

In scratchblocks you can force blocks to appear however you want them to, e.g.
using ((seven :: custom reporter) :: custom-arg ring) :: sensing 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. list
  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
These categories are used to say which category your blocks should be colored as, for example:

[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
As you can see, you write down your block as normal, but then put two colons, ::, and the name of the category.

Notice that you can still put comments after you apply your styles.

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 

And 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 script :: control cstart
without screen refresh :: control cend
[/scratchblocks]

run script :: control cstart
without screen refresh :: control cend

Some of the shapes are really weird and have an interesting derivation, for example ring, which was meant to be used to mimic Snap! and BYOB blocks

[scratchblocks]
map ((() * (2)) :: grey ring) over [list v] :: list
[/scratchblocks]

map ((() * (2)) :: grey ring) over [list v] :: list

but can lead to some pretty bizarre outcomes:
Isn't this odd... :: sensing ring

There is also 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

See how celse blocks work? You just write the text, then style it:

[scratchblocks]
when gf clicked :: extension cstart
do @stop evil stuff :: lists
then :: celse
do good stuff! :: operators
then, stop :: cend cap
[/scratchblocks]

when gf clicked :: extension cstart
do evil stuff :: list
then :: celse
do good stuff! :: operators
then, stop :: cend cap

Remember, use the proper testing topic to try out your new-found skills: http://scratch.mit.edu/discuss/topic/14778/

Just Rolling Around!

( [roll v] and [laugh v])
;
amateurradiogeek15
Scratcher
1000+ posts

ITopic: Everything you never knew about [scratchblocks]!

^^
Was it really necessary to quote all that?


Work of @PeaInAPod

Come on down and join us!!






When All Else Fails, There's Amateur Radio!!!
It could save your life!
Proud Member of The Holland Amateur Radio Club.
Thousands of clubs around the planet!
Emergency communications!
Lots of Fun!
Join the Ultra Player Collaboration making a Cloud Multiplayer Game!!!!!
Multiplayer siggy=




VMan_2002
Scratcher
61 posts

ITopic: Everything you never knew about [scratchblocks]!

amateurradiogeek15 wrote:

^^
Was it really necessary to quote all that?
I agree if your saying NO

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
amateurradiogeek15
Scratcher
1000+ posts

ITopic: Everything you never knew about [scratchblocks]!

VMan_2002 wrote:

amateurradiogeek15 wrote:

^^
Was it really necessary to quote all that?
I agree if your saying NO
Exactly.


Work of @PeaInAPod

Come on down and join us!!






When All Else Fails, There's Amateur Radio!!!
It could save your life!
Proud Member of The Holland Amateur Radio Club.
Thousands of clubs around the planet!
Emergency communications!
Lots of Fun!
Join the Ultra Player Collaboration making a Cloud Multiplayer Game!!!!!
Multiplayer siggy=




Tropic
Scratcher
1000+ posts

ITopic: Everything you never knew about [scratchblocks]!

amateurradiogeek15 wrote:

^^
Was it really necessary to quote all that?



My browser / operating system: Windows NT 10.0, Firefox 40.0.2, Flash 20.0 (release 0)
Last eaten by Evil Kumquat (Today 19:30:11)
when I receive [flash_player_version] :: motion
say [Windows 7, Flash 15.0 (release 0)] :: sensing
stop script :: custom
Tropical Productions
VMan_2002
Scratcher
61 posts

ITopic: Everything you never knew about [scratchblocks]!

Tropic wrote:

amateurradiogeek15 wrote:

Was it really necessary to quote all that?
ask [Was it really necessary to quote all that?] and wait
if <(answer) = [yes]>
say [Correct.]
else
say [You will never learn.]
end

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
bdavi
Scratcher
10 posts

ITopic: Everything you never knew about [scratchblocks]!

YEAH
CosmicHamster
Scratcher
100+ posts

ITopic: Everything you never knew about [scratchblocks]!

Testing…

when {move (10) steps} clicked :: sensing hat
then :: variables cstart
move (103943) steps, not (10)! :: motion
but you should also :: celse
Give (sprite1 :: looks) aka (CosmicHamster v) a scratch behind her ear :: operators
so ::celse
she feels <<happy :: pen> and <cheerful :: list> :: sound> :: sensing
because :: celse
(Cosmic Hamsters v) love it when (humans v) pet them :: pen
eventhough ::celse
<(Cosmic Hamsters v) and (humans v) :: sound> live in totally different dimensions :: motion
And now I'll just try something…

((((((Cosmic :: extension) :: looks ) :: motion ) :: operators ) :: control ) :: data )
((((((Hamster :: extension) :: looks ) :: motion ) :: operators ) :: control ) :: data )

I'm just a little cosmic hamster from Planet NO, which is in another dimension. Are you, too?
(I'm also a forum lurker…)
#PrayForParis
Check out my games, if you want to. I make sure to share a cool variety, but even though I haven't shared much, I try to make each one count, but they can only count to 7 so far.


Coins ~ Ninety Degrees ~ Spiked Walls ~ Colourz ~ Bubble Popper ~ Candy Thief ~ Gameplace
LSulin
Scratcher
8 posts

ITopic: Everything you never knew about [scratchblocks]!

replace item (42 v) of [Numbers v] with [the username]boolean
LSulin
Scratcher
8 posts

ITopic: Everything you never knew about [scratchblocks]!

if <awesome username> then

end
[scratchblocks]
show :: sensing cstart
end
[/scratchblocks]
LSulin
Scratcher
8 posts

ITopic: Everything you never knew about [scratchblocks]!

define falcon punch right?(look awesome) (this is wierd)
LSulin
Scratcher
8 posts

ITopic: Everything you never knew about [scratchblocks]!

when backdrop switches to [hello]
ask [who is having fun?(username)] and wait
think [I'm having fun] for (5555555) secs
LSulin
Scratcher
8 posts

ITopic: Everything you never knew about [scratchblocks]!

<mouse down?>
say [hello<<so> and <wow >>]boolean
pen down
if <unknown> then
say [hello] for (322354) secs
end

Powered by DjangoBB