Discuss Scratch

liam48D
Scratcher
1000+ posts

Suggesting Scripts with [Scratchblocks]

BIG restart on May 28, 2014!!

Suggesting Scripts with [Scratchblocks]
Answers to the [scratchblocks]
This tutorial covers how to use [scratchblocks]. [scratchblocks] is a tag in the Scratch Forums that let you write Scratch scripts in your own threads!

Making your first [Scratchblocks]
Let's make our first [scratchblock]. It's going to be the block "move (10) steps".
Let's see what we're going to make!

move (10) steps

OK, so that is awesome. Plus, it's not an image! Try dragging your mouse over the text. it should highlight the text, rather than drag an image!

But how did I make it?

As it turns out, I used the [scratchblocks] tag. If you haven't guessed. Try writing this in the topic replier - oh wait, you probably shouldn't do that in this tutorial area. There's actually a [scratchblocks] official testing topic, made by the quite cool jvvg. You can try out your scripts there without worry.

[scratchblocks]

[/scratchblocks]

Ok, so now we have the tag. Not that you can actually tell, as you can't see your post yet. And even if you could, you still wouldn't see anything, because it doesn't have any code.

But anywho; let's get quickly to seeing our code, so that when it's made, we can make sure we didn't make any errors. To preview your post, just click on the “Preview” button; it's a green check mark button on the far right of the tool bar in the text editor.

And.. great, nothing really happened. But a new box did appear in the bottom of the screen, and that's where you can see your scripts!

Technical Coolness: The Preview box resets every time you click one of the buttons in the toolbar, or you click enter on your keyboard.

Soo, now you can see the result of the code you write. Awesome. But there is no code, so there is no restart - let's make some code!

// Ok, so let's make a block in our [scratchblocks] tag.
[scratchblocks]
// We are going to put some code here.
move (10) steps
// Now we need to close the [scratchblocks] tag, or our scripts will continue on to other stuff in our post.
[/scratchblocks]
// Awesome!
move (10) steps

Just put that code inside your post, hit enter (not literally xP), and enjoy!

If you can't
Reporters and Inputs
OK, so now we have a normal block.. but what if we want a reporter, such as "(6) + (2)“? Any script needs a reporter, and ours is no exception. In this case, we will make a new block type: ”( )".

// Here, we will make a new type of block: "(   )".
[scratchblocks]
( + )
[/scratchblocks]
// Try making this in your script.
Hmm, it's kinda wierd. Look at what it made:
( + )
We got a variable looking thing. Maybe this will work..
// Maybe a different approach will make it look like the "(5 + 3)" block.
[scratchblocks]
(5 + 3)
[/scratchblocks]
(5 + 3)
Nope, still a variable.
This is because we aren't dealing with inputs the right way. Remember our "move (10) steps" block? Well, we put parenthesis around the “10”. We have to do that with (almost) every input, so let's do that.
// Ahem. Are you not going to? The answers are in the answer area.
You should get..
((5) + (3))
There's also the “<…>” block to make booleans, but they don't work well and just display as a normal reporter.
<I am a boolean!>
<I am a boolean!>
Plus that's an obsolete block.

Technical Coolness: Technically, there is the “{}” block input container that will put a block in a block, but we'll get to that later.

There may or may not be very much here yet. I am adding more!

Last edited by liam48D (May 28, 2014 21:10:48)


202e-202e-202e-202e-202e UNI-CODE~~~~~
AonymousGuy
Scratcher
1000+ posts

Suggesting Scripts with [Scratchblocks]

I already knew this.

Should there be some sort of Scratchblocks documentation?

Also, should this be stickied?
liam48D
Scratcher
1000+ posts

Suggesting Scripts with [Scratchblocks]

AonymousGuy wrote:

I already knew this.

Should there be some sort of Scratchblocks documentation?

Also, should this be stickied?

1. Lol! xD

2. There should TOTALLY be. Somebody needs to make the wiki page better.

3. Yes! It'll make it a lot easier to suggest stuff!

202e-202e-202e-202e-202e UNI-CODE~~~~~
Paddle2See
Scratch Team
1000+ posts

Suggesting Scripts with [Scratchblocks]

Cool stuff - I didn't know you could force blocks into particular shapes. This should totally be added to the Wiki documentation of Scratchblocks

Scratch Team Member, kayak enthusiast, and servant to multiple cats.

;
liam48D
Scratcher
1000+ posts

Suggesting Scripts with [Scratchblocks]

Paddle2See wrote:

Cool stuff - I didn't know you could force blocks into particular shapes. This should totally be added to the Wiki documentation of Scratchblocks
Yup! I think it's awesome!

EDIT: I noticed that you can't use C Blocks as inputs.

Last edited by liam48D (May 24, 2014 13:23:44)


202e-202e-202e-202e-202e UNI-CODE~~~~~
Blaze349
Scratcher
1000+ posts

Suggesting Scripts with [Scratchblocks]

AonymousGuy wrote:

I already knew this.

Should there be some sort of Scratchblocks documentation?

Also, should this be stickied?
So did I
liam48D
Scratcher
1000+ posts

Suggesting Scripts with [Scratchblocks]

Lol, maybe some people do know this.

Plus, I think Paddle2See or somebody is adding this info to the Scratch Wiki!

202e-202e-202e-202e-202e UNI-CODE~~~~~
AonymousGuy
Scratcher
1000+ posts

Suggesting Scripts with [Scratchblocks]

Did you know about the
:: ring
block shape?

when gf clicked
launch ({say [Hello!]}:: grey ring) :: control //"Snap!" script!
MeDiaMond
Scratcher
500+ posts

Suggesting Scripts with [Scratchblocks]

AonymousGuy wrote:

Did you know about the
:: ring
block shape?

when gf clicked
launch ({say [Hello!]}:: grey ring) :: control //"Snap!" script!
I didn't. It's cool!

Paddle2See wrote:

Cool stuff - I didn't know you could force blocks into particular shapes. This should totally be added to the Wiki documentation of Scratchblocks
You really didn't know that?
liam48D
Scratcher
1000+ posts

Suggesting Scripts with [Scratchblocks]

AonymousGuy wrote:

Did you know about the
:: ring
block shape?

when gf clicked
launch ({say [Hello!]}:: grey ring) :: control //"Snap!" script!
Wow, I'll have to add that! Thanks!

202e-202e-202e-202e-202e UNI-CODE~~~~~
blob8108
Scratcher
1000+ posts

Suggesting Scripts with [Scratchblocks]

I think this *is* already documented on the wiki somewhere…

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

Suggesting Scripts with [Scratchblocks]

blob8108 wrote:

I think this *is* already documented on the wiki somewhere…
Block Plugin/Syntax#Hacks

Last edited by djdolphin (May 25, 2014 11:00:22)


!
davidkt
Scratcher
1000+ posts

Suggesting Scripts with [Scratchblocks]

I already knew this, but great thread! This should be stickied!

Remember when I looked like this? I still do.


Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
davidkt
Scratcher
1000+ posts

Suggesting Scripts with [Scratchblocks]

AonymousGuy wrote:

Did you know about the
:: ring
block shape?

when gf clicked
launch ({say [Hello!]}:: grey ring) :: control //"Snap!" script!
No, I didn't!
{::ring motion}::ring operators 

Last edited by davidkt (May 27, 2014 20:06:44)


Remember when I looked like this? I still do.


Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
liam48D
Scratcher
1000+ posts

Suggesting Scripts with [Scratchblocks]

I knew I saw this stuff on the wiki SOMEWHERE.

202e-202e-202e-202e-202e UNI-CODE~~~~~
Oui1024
Scratcher
40 posts

Suggesting Scripts with [Scratchblocks]

({ move () steps })


So, like that kinda?

l00mynarti confirm8d/color]
YOU SAW NOTHING.
ev3commander
Scratcher
500+ posts

Suggesting Scripts with [Scratchblocks]

(Hiiiii.::ring)

You won't be unknown anymore
My browser / operating system: Windows 7, Chrome 32.XX.XXXX.XX, Flash 12.0 (release 0)
My alternative browser / operating system: OS X 10.9.5, Safari 7, Flash 15.0 (release 0)
Reached 500+ on April 8, 2015
ev3commander
Scratcher
500+ posts

Suggesting Scripts with [Scratchblocks]

ev3commander wrote:

(Hiiiii.::ring)
Well, that failed.
Here's my code:
[scratchblocks]
(Hiiiii.::ring)
[/scratchblocks]

You won't be unknown anymore
My browser / operating system: Windows 7, Chrome 32.XX.XXXX.XX, Flash 12.0 (release 0)
My alternative browser / operating system: OS X 10.9.5, Safari 7, Flash 15.0 (release 0)
Reached 500+ on April 8, 2015
liam48D
Scratcher
1000+ posts

Suggesting Scripts with [Scratchblocks]

ev3commander wrote:

ev3commander wrote:

(Hiiiii.::ring)
Well, that failed.
Here's my code:
[scratchblocks]
(Hiiiii.::ring)
[/scratchblocks]

(stuff ( Hi! ) :: grey ring )
(stuff ( Hi! ) :: grey ring )

202e-202e-202e-202e-202e UNI-CODE~~~~~

Powered by DjangoBB

Standard | Mobile