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

#276 2010-05-01 00:55:36

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Dazachi wrote:

I'm still kinda confused. How can I set a variable just for my block?

I can think of two possible meanings for your question, so I'm going to answer both of them.

(1) How can I have a variable just inside my block to hold information temporarily while the block is running?

Answer: While editing your block, look near the top of the Variables menu for the dark grey "Script Variables" block.  Drag it into your block's script.  It comes with a variable named "a" but you can click on that name to change it to something else.  Then you can use the regular variable mechanisms like SET and CHANGE with it, **but only when the SET or CHANGE block is actually attached to your script** not just hanging loose in the block editor.  And you can drag the variable name out of the Script Variables block into whatever block needs to see the value.

(2) How can I have a variable that retains its value even when my block isn't running, but is visible only inside my block?

Answer: This can be done, but it's more complicated.
Let's say you want your block to be called MYBLK.  Don't make a block MYBLK!  Instead, make a *variable* (sprite or global as desired) named MYBLK, and then make a block MAKE-MYBLK, a command, that contains

     Script Variables <var>
     SET <var> TO <start-value>
     SET <MYBLK> TO [THE SCRIPT ......]

where you put whatever your block should do inside the THE SCRIPT block.  Then just run MAKE-MYBLK.  Now, when you want to use your block, you have to say

     RUN <MYBLK>

(or CALL if it's a reporter/predicate).

If neither of these is what you meant, please try asking in more detail.  Thanks.


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#277 2010-05-01 01:28:49

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Okay, I give up, clearly you need help with this...

http://cs.berkeley.edu/~bh/lamgobo.gif


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#278 2010-05-01 07:52:36

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

Dazachi wrote:

I'm still kinda confused. How can I set a variable just for my block?

I can think of two possible meanings for your question, so I'm going to answer both of them.

(1) How can I have a variable just inside my block to hold information temporarily while the block is running?

Answer: While editing your block, look near the top of the Variables menu for the dark grey "Script Variables" block.  Drag it into your block's script.  It comes with a variable named "a" but you can click on that name to change it to something else.  Then you can use the regular variable mechanisms like SET and CHANGE with it, **but only when the SET or CHANGE block is actually attached to your script** not just hanging loose in the block editor.  And you can drag the variable name out of the Script Variables block into whatever block needs to see the value.

(2) How can I have a variable that retains its value even when my block isn't running, but is visible only inside my block?

Answer: This can be done, but it's more complicated.
Let's say you want your block to be called MYBLK.  Don't make a block MYBLK!  Instead, make a *variable* (sprite or global as desired) named MYBLK, and then make a block MAKE-MYBLK, a command, that contains

     Script Variables <var>
     SET <var> TO <start-value>
     SET <MYBLK> TO [THE SCRIPT ......]

where you put whatever your block should do inside the THE SCRIPT block.  Then just run MAKE-MYBLK.  Now, when you want to use your block, you have to say

     RUN <MYBLK>

(or CALL if it's a reporter/predicate).

If neither of these is what you meant, please try asking in more detail.  Thanks.

Thank you! The first one is the one I wanted. Now my blocks work!


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

Offline

 

#279 2010-05-01 07:56:09

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

Okay, I give up, clearly you need help with this...

http://cs.berkeley.edu/~bh/lamgobo.gif

What?


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

Offline

 

#280 2010-05-01 09:46:53

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

Okay, I give up, clearly you need help with this...

http://cs.berkeley.edu/~bh/lamgobo.gif

I can't find anything that resembles that on a (almost) complete list of mathematical symbols. Maybe someone else will have more luck than I....

EDIT: It looks kinda like the Greek lambda, but that doesn't make a whole lot of sense.
http://upload.wikimedia.org/wikipedia/commons/thumb/f/f9/Greek_lc_lamda.svg/400px-Greek_lc_lamda.svg.png

Last edited by shadow_7283 (2010-05-01 09:58:47)

Offline

 

#281 2010-05-01 10:13:42

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: BYOB 3 - Discussion Thread

shadow_7283 wrote:

bharvey wrote:

Okay, I give up, clearly you need help with this...

http://cs.berkeley.edu/~bh/lamgobo.gif

I can't find anything that resembles that on a (almost) complete list of mathematical symbols. Maybe someone else will have more luck than I....

EDIT: It looks kinda like the Greek lambda, but that doesn't make a whole lot of sense.
http://upload.wikimedia.org/wikipedia/c … da.svg.png

Yes it does.... You know how in the trailer it says

Scratch4cs = Scratch
(+ BYOB + λ)

meaning you can make your own blocks and use lambda programming.


nXIII

Offline

 

#282 2010-05-01 11:22:42

Vista4563
Scratcher
Registered: 2009-07-20
Posts: 500+

Re: BYOB 3 - Discussion Thread

nXIII wrote:

shadow_7283 wrote:

bharvey wrote:

Okay, I give up, clearly you need help with this...

http://cs.berkeley.edu/~bh/lamgobo.gif

I can't find anything that resembles that on a (almost) complete list of mathematical symbols. Maybe someone else will have more luck than I....

EDIT: It looks kinda like the Greek lambda, but that doesn't make a whole lot of sense.
http://upload.wikimedia.org/wikipedia/c … da.svg.png

Yes it does.... You know how in the trailer it says

Scratch4cs = Scratch
(+ BYOB + λ)

meaning you can make your own blocks and use lambda programming.

Exactly... at first, I thought that extra thing on Gobo was some kind of greek letter.

I made a beta tag... you can use it if you want.
http://img683.imageshack.us/img683/988/byobeta.png


Team Vista | TBG Moderator | #stopKony #Kony2012 | http://ls.gd/icgrin http://is.gd/78GWUZ
http://is.gd/jEY5Ihttp://is.gd/Vl19zR http://i.imgur.com/L4HIs.png

Offline

 

#283 2010-05-01 11:32:28

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

shadow_7283 wrote:

looks kinda like

Anyone who's a better artist than I is welcome to contribute an improved version.  smile   But everyone at Berkeley (where we use SICP in our first computer science course) got it right away!  (Of course they also have the advantage of knowing what a fanatic I am about first-class functions -- but so do you, given the movie!)

Last edited by bharvey (2010-05-01 11:36:37)


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#284 2010-05-01 12:22:13

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: BYOB 3 - Discussion Thread

nXIII wrote:

shadow_7283 wrote:

bharvey wrote:

Okay, I give up, clearly you need help with this...

http://cs.berkeley.edu/~bh/lamgobo.gif

I can't find anything that resembles that on a (almost) complete list of mathematical symbols. Maybe someone else will have more luck than I....

EDIT: It looks kinda like the Greek lambda, but that doesn't make a whole lot of sense.
http://upload.wikimedia.org/wikipedia/c … da.svg.png

Yes it does.... You know how in the trailer it says

Scratch4cs = Scratch
(+ BYOB + λ)

meaning you can make your own blocks and use lambda programming.

Cool!


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

Offline

 

#285 2010-05-01 21:43:28

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

I am pleased to announce that Tutorial 2: Lists and Higher Order Functions is finally done!  It's on the Scratch site in three(!!!) parts, starting with http://scratch.mit.edu/projects/bharvey/1021777.  I'm really hoping that at least some of you will find it as life-changing as it was when I learned about functional programming!


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#286 2010-05-02 01:27:17

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Okay, I guess you're right, maybe this one is better?

http://cs.berkeley.edu/~bh/gobol3.gif


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#287 2010-05-02 01:50:46

ThePCKid
Scratcher
Registered: 2009-09-16
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

Okay, I guess you're right, maybe this one is better?

http://cs.berkeley.edu/~bh/gobol3.gif

That is cool!

Offline

 

#288 2010-05-02 10:01:01

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

Okay, I guess you're right, maybe this one is better?

http://cs.berkeley.edu/~bh/gobol3.gif

It still looks very rough.

Firstly, don't use black - use the gobo's grey border color. And make sure the thickness of the border is the same all the way around, and it's smooth.


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

Offline

 

#289 2010-05-02 11:57:34

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Lucario621 wrote:

bharvey wrote:

Okay, I guess you're right, maybe this one is better?

http://cs.berkeley.edu/~bh/gobol3.gif

It still looks very rough.

Firstly, don't use black - use the gobo's grey border color. And make sure the thickness of the border is the same all the way around, and it's smooth.

But I don't think the normal Gobo's border is the same thickness all the way around


nXIII

Offline

 

#290 2010-05-02 12:27:21

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: BYOB 3 - Discussion Thread

nXIII wrote:

Lucario621 wrote:

bharvey wrote:

Okay, I guess you're right, maybe this one is better?

http://cs.berkeley.edu/~bh/gobol3.gif

It still looks very rough.

Firstly, don't use black - use the gobo's grey border color. And make sure the thickness of the border is the same all the way around, and it's smooth.

But I don't think the normal Gobo's border is the same thickness all the way around

Well, for the most part, at least.


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

Offline

 

#291 2010-05-02 12:55:16

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Jens - back to my chord block idea on the third page of this thread (assuming you have the default amount of posts per page)

What type of input types should the different inputs be? They could be any, or possibly text, I really don't know.

Secondly (and more importantly), I can I have the script play the multiple notes at the same time? Perhaps, if it is possible, could the block broadcast messages just to other scripts within the block definition? That might work - if you have that implemented.


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

Offline

 

#292 2010-05-02 13:01:26

markyparky56
Scratcher
Registered: 2008-03-20
Posts: 1000+

Re: BYOB 3 - Discussion Thread

I found another glitch.

http://img101.imageshack.us/img101/2558/glitch2.gif
If you put a rounded reporter block into a boolean block, such as the ones in the picture, then take it out it makes it only allow you to enter numbers (Or intergers) and no text (Or strings)


http://j.mp/jgVnTq
Check out my game engine development site: NewDawn I'm a Level 171 Scratcher.I am http://bit.ly/nkvLNT

Offline

 

#293 2010-05-02 13:06:22

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: BYOB 3 - Discussion Thread

In addition (to my previous post), by looking at my script on page 3, within each of the else part of the if else blocks, should I have a stop block afterwards? Or is it not necessary?


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

Offline

 

#294 2010-05-02 13:20:52

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Is it possible to remove a variable from a block definition? Because I'm not able to...


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

Offline

 

#295 2010-05-02 13:31:58

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: BYOB 3 - Discussion Thread

I decided to change the note and octave to just note (as in midi note). What is the range of midi notes on Scratch, for an actual keyboard? I think it's 21 (the lowest A) to 108 (the highest C) - but I might be wrong (I mean, doesn't that make 87 keys lol?).


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

Offline

 

#296 2010-05-02 13:36:05

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Picky, picky.

http://cs.berkeley.edu/~bh/gobol3.gif


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#297 2010-05-02 13:42:14

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

Picky, picky.

http://cs.berkeley.edu/~bh/gobol3.gif

tongue

TBH, that's great! A lot better! That's overall what I wanted  smile

Now I COULD complain some more about having you dither it a bit more, but I can tell you're not exactly the 'graphics' person, if you know what I mean  tongue

Should I replace the picture of Gobo on the first post with this new one?

Last edited by Lucario621 (2010-05-02 13:42:31)


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

Offline

 

#298 2010-05-02 13:49:34

markyparky56
Scratcher
Registered: 2008-03-20
Posts: 1000+

Re: BYOB 3 - Discussion Thread

I think iv got it now!

What doy uo think of my one?

http://img99.imageshack.us/img99/6070/gobobyob.gif

Last edited by markyparky56 (2010-05-02 13:53:53)


http://j.mp/jgVnTq
Check out my game engine development site: NewDawn I'm a Level 171 Scratcher.I am http://bit.ly/nkvLNT

Offline

 

#299 2010-05-02 13:56:20

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Lucario621 wrote:

What type of input types should the different inputs be? They could be any, or possibly text, I really don't know.

I'm not Jens, and not a musician, so I'm going to leave most of this for him to answer.  But I can respond to this part.  There is actually no difference between Any and Text except for the shape of the slot, so just use whatever looks right to you.  smile

Lucario621 wrote:

In addition (to my previous post), by looking at my script on page 3, within each of the else part of the if else blocks, should I have a stop block afterwards? Or is it not necessary?

Not necessary, unless there's more code below the whole thing that you want to avoid.

We should, by the way, have a multiway test block so people don't have to nest IFs like that.  I'm waiting for Jens to invent the notation to make a /group/ of inputs variadic, so I can write a block like

Code:

IF <boolean> THEN <C-slot> 
     { ELSE IF <boolean> THEN <C-slot> }...
     ELSE <C-slot>

http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#300 2010-05-02 13:56:56

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: BYOB 3 - Discussion Thread

markyparky56 wrote:

I think iv got it now!

What doy uo think of my one?

http://img99.imageshack.us/img99/6070/gobobyob.gif

That's cool markyparky56 - but do you understand why in Gobo's image, Gobo looked that way? It's not just for decoration - it's because it's supposed to look like this:
http://upload.wikimedia.org/wikipedia/commons/thumb/f/f9/Greek_lc_lamda.svg/400px-Greek_lc_lamda.svg.png
meaning you can make your own blocks and use lambda programming.

Yours doesn't look like that at all, so that would ruin the purpose of the new gobo  wink


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

Offline

 

Board footer