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

#2451 2011-01-21 12:24:57

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

Re: BYOB 3 - Discussion Thread

Off topic warning...

clintonhackers wrote:

hmm.  and here I *love* school.  both halves.

I love teaching, but I hate teaching sit-down-and-shut-up(*) and I hate writing and grading exams, and dealing with students cheating on them, and arguing with students about grades.

(*) At the elementary school where I volunteer TuTh, it's a cardinal sin to utter the actual words "shut up"; people treat it as if you'd said "[We'll leave it at 'racial slur' here, remember that this is the Scratch forums, even if it's a section that kids rarely visit  wink  --fullmoon]" -- but the teachers tell the kids to shut up every three minues.  They just do it using more words, such as "Now, who can help Johnny make a better decision?"  Drives me crazy.  (The other stuff, about exams and grades, is from the job I get paid for at the university.)

Last edited by fullmoon (2011-01-21 18:25:30)


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

Offline

 

#2452 2011-01-21 18:21:35

DarthPickley
Scratcher
Registered: 2008-06-13
Posts: 100+

Re: BYOB 3 - Discussion Thread

In BYOB3, I was wondering:
what if you wanted to create an If < > - Then [ ] - Else If < > - Then[ ] - Else If < > - Then [ ] > and you could always add more Else Ifs.
So far all that seems possible is just to separately have a list of conditions and then the actions.

There probably are other things about this but I think that being able to do something like that should be more obvious how to do it. And I can't think of a very good way to do it using menu button things and not text, like
( Else If condition? then event[ )...


-----------------------------------------------------------------------

Also, I would be really excited if someone figured out a way to make custom blocks that do stuff for visual things, like allowing you to create new visual effects. currently, custom-made blocks let you use the pre-made blocks, as well as several control structures, so that you can neatly bundle some processes that would otherwise use up a lot of workspace and look messy, and your variables and everything are more organized. also it lets you do a lot of fancy stuff with subscripts in super-recursive ways (I get confused if I try to understand why you are trying to put a list inside a boolean inside a pointer to a list of lists of blocks that are directed at the stage or whatever).

However, you cannot introduce other kinds of blocks that would be used in more creative ways. I suppose that that is what panther and the others are about, and byob3 is strictly about scratch for college-level computer scientists or something. But I wish you could make a good, new looks block, something that could map an image into another image based on a user-defined equation. Also a mapping that maps both the position components of each picture element and the color components. and maybe adding in as well some (pseudo-)randomness to get neat effects.
Another really neat idea is that you could have canvasses for drawing other than just the stage. I know smalltalk and squeak support those things, all sprites are canvasses for drawing on by the user, and the stage is a canvass which sprites can draw on. I'm not sure how difficult it would be to take some features which exist inside the costume editor such as flooding and highlighting particular regions, but if each costume had another button, one that said "make into canvas", and then you had a canvas type which could be changed in any way. It is like nesting, you can have costumes each have their own visual effects and they all are used by the sprite.

I just love how you can tell other sprites to carry out scripts by the way!

Last edited by DarthPickley (2011-01-21 19:03:32)

Offline

 

#2453 2011-01-21 19:03:41

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

Re: BYOB 3 - Discussion Thread

DarthPickley wrote:

In BYOB3, I was wondering:
what if you wanted to create an If < > - Then [ ] - Else If < > - Then[ ] - Else If < > - Then [ ] > and you could always add more Else Ifs.
So far all that seems possible is just to separately have a list of conditions and then the actions.

Yeah, that's what I thought until nXIII posted his brilliant solution to the problem.  Write an ELSEIF block that takes a test (a predicate) and an action (a command script) and reports TRUE if the test succeeded (in which case it ran the action, and the outer IF block should stop) or FALSE if it didn't (in which case the outer IF block should go to the next ELSEIF).  The IF block takes multiple inputs of type predicate.

There's a SWITCH block in tools.ypr based on this approach.


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

Offline

 

#2454 2011-01-21 20:56:20

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

Re: BYOB 3 - Discussion Thread

DarthPickley wrote:

But I wish you could make a good, new looks block, something that could map an image into another image based on a user-defined equation.

Hey, no fair editing another question into your message after I answer it!  smile

But, yeah, it's on the list.  It might not make it into 3.1, but I think the right way to work this is that you can say

ITEM <xcoord> OF [ITEM <ycoord> OF <costume/background>]

and get a list-of-three RGB pixel.  And REPLACE ITEM ditto.  Given that, people can write libraries of "apply this nine-input function to each pixel along with its eight neighbors" or whatever else seems useful.

Also a mapping that maps both the position components of each picture element and the color components. and maybe adding in as well some (pseudo-)randomness to get neat effects.

No, that's not the BYOB Way.  smile   We give you the minimal set of tools you need to be able to write the functions you want in BYOB!  In this case, by extending the domain of the existing ITEM blocks, we have a zero-footprint way to manipulate images.

I just love how you can tell other sprites to carry out scripts by the way!

Thanks!


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

Offline

 

#2455 2011-01-22 09:49:17

rubiks_cube_guy238
Scratcher
Registered: 2009-07-02
Posts: 100+

Re: BYOB 3 - Discussion Thread

Instead of having to do [run ([a block] of [a sprite])] to get a sprite to do something, why not add this little block I made:
blockSpec:

Code:

('tell %m to' #c #doTellSpriteTo)

Code (put in ScratchProcess):

Code:

doTellSpriteTo
    | t1 t2 t3 |
    t1 _ stackFrame expression.
    t2 _ stackFrame arguments.
    t2 size = 0
        ifTrue: 
            [t3 _ t1 argumentAt: 1.
            ^ self pushStackFrame: (ScratchStackFrame new expression: t3)].
    self popStackFrame.
    t3 _ t1 fullCopy.
    t3
        allMorphsDo: [:t4 | (t4 respondsTo: #receiver:)
                ifTrue: [t4 receiver: (ScriptableScratchMorph new coerceSpriteArg: t2 first)]].
    self pushStackFrame: (ScratchStackFrame new expression: t3 firstBlockList)

Finally, go to SpriteArgMorph presentMenu, and after where you find

Code:

t3 do: [:t8 | t4 add: t8 objName action: t8].

add

Code:

t2 = #doTellSpriteTo
    ifTrue: 
        [t4 labels at: 1 put: 'Stage' localized asUTF8.
        t4 selections at: 1 put: t1 workPane].

The glass is never half full nor half empty; it is twice as large as it needs to be.

Offline

 

#2456 2011-01-22 10:48:49

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Yeah, that's pretty cool, rubiks_cube_guy238, but of of BYOB3's grand ideas to to support first class procedures. What if the block(s) that you want to run aren't the shape of command blocks but, say, stored in a variable or in a list element? Or if you want to CALL something?

(Hey, you should be using *real* source code with variable names and comments, not the cryptic decompiled stuff that comes out of shift-R clicking, that's why we're posting dev images  smile  )


Jens Mönig

Offline

 

#2457 2011-01-22 13:58:48

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: BYOB 3 - Discussion Thread

On the wikipedia article about scratch, it mentions BYOB, but they spelled Jens' name wrong!
Here's the link: http://en.wikipedia.org/wiki/Scratch_pr … erivatives

Offline

 

#2458 2011-01-22 16:27:04

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: BYOB 3 - Discussion Thread

scimonster wrote:

On the wikipedia article about scratch, it mentions BYOB, but they spelled Jens' name wrong!
Here's the link: http://en.wikipedia.org/wiki/Scratch_pr … erivatives

I've seen it spelled 'Moenig', but I changed it it 'Mönig' just for fun.

By the way, I am absolutely loving the new experimental beta with first-class sprites. But is there any chance of a (spawn [foo] named [ ]) reporter?


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#2459 2011-01-22 16:52:25

DarthPickley
Scratcher
Registered: 2008-06-13
Posts: 100+

Re: BYOB 3 - Discussion Thread

sure, but that sounds like it will probably be slow.

I made a triangle shader, and made it atomic, but no matter what, I couldn't make it fast enough for how I wanted to do that.

does BYOB have to be so slow that some very useful things will be so complicated and slow as to not be useful?

Offline

 

#2460 2011-01-22 16:58:35

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

Re: BYOB 3 - Discussion Thread

It's the pen, not BYOB. You seem very concerned for its well being ( tongue ), but cool art isn't BYOB's main intention.

Plus BYOB hasn't really been optimized for speed yet (if I understand correctly).

Offline

 

#2461 2011-01-22 19:28:57

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

Re: BYOB 3 - Discussion Thread

fullmoon wrote:

But is there any chance of a (spawn [foo] named [ ]) reporter?

Nope.  Instead you'll be able to write your own, using

CALL [<SPAWN> OF <FOO>]

to make the new sprite, and then

RUN [[SET <_NAME> TO <whatever>] OF <new sprite>]

to change its name.  At least I think that's how it'll work.  This assumes (Jens?) the ability to drag any block onto the left dropdown slot of the OF block.  And what I've shown as _NAME will be some representation, not yet determined, for implicit attributes of sprites.  (We want a way to make all of them readable and writeable by scripts without having a trillion blocks like Panther.  smile  )


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

Offline

 

#2462 2011-01-22 19:35:19

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

Re: BYOB 3 - Discussion Thread

shadow_7283 wrote:

but cool art isn't BYOB's main intention.

That's true.  On the other hand, there is some very cool computer science in picture processing, and I'd be delighted if we could make it practical to implement the equivalent of Photoshop effects plugins in BYOB.

Plus BYOB hasn't really been optimized for speed yet (if I understand correctly).

Indeed.  It's slow as molasses, and 3.1 won't fix that; you'll have to wait for 4.0 in the fall, which, if not blindingly fast, will at least be usable for computationally interesting projects.  (I'm hoping for blindingly fast, but it'll still be an interpreter on top of an interpreter, probably.)


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

Offline

 

#2463 2011-01-22 20:44:02

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

Re: BYOB 3 - Discussion Thread

Hmm. Almost 100 pages! Cool.

And, I've recently just about half an hour ago been working on a new project (tile-based), however, because there's no good way to copy lists, I have to use BYOB.  smile  I can't even individually copy items - because I want to have a "Visible chunk" list, and it has the visible chunk out of all of the chunks in the game (a chunk is a part of the world - so it can be rendered separately). So I can't just say copy from chunk1 to Visible Chunk - it has to be from chunk # (visible chunk (variable)) to Visible Chunk. Which isn't currently possible.

Last edited by Lucario621 (2011-01-22 20:50:01)


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

Offline

 

#2464 2011-01-22 23:51:15

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

fullmoon wrote:

But is there any chance of a (spawn [foo] named [ ]) reporter?

Nope.  Instead you'll be able to write your own, using

CALL [<SPAWN> OF <FOO>]

to make the new sprite, and then

RUN [[SET <_NAME> TO <whatever>] OF <new sprite>]

to change its name.  At least I think that's how it'll work.  This assumes (Jens?) the ability to drag any block onto the left dropdown slot of the OF block.  And what I've shown as _NAME will be some representation, not yet determined, for implicit attributes of sprites.  (We want a way to make all of them readable and writeable by scripts without having a trillion blocks like Panther.  smile  )

Sounds elegant! I can't wait to see it happen.


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#2465 2011-01-23 02:11:56

JTxt
Scratcher
Registered: 2010-05-19
Posts: 100+

Re: BYOB 3 - Discussion Thread

Lucario621 wrote:

Hmm. Almost 100 pages! Cool.

And, I've recently just about half an hour ago been working on a new project (tile-based), however, because there's no good way to copy lists, I have to use BYOB.  smile  I can't even individually copy items - because I want to have a "Visible chunk" list, and it has the visible chunk out of all of the chunks in the game (a chunk is a part of the world - so it can be rendered separately). So I can't just say copy from chunk1 to Visible Chunk - it has to be from chunk # (visible chunk (variable)) to Visible Chunk. Which isn't currently possible.

And it passed 65536 views!  smile
Cool problem, I responded to you here.

On topic: Go BYOB.  smile
Really, thanks for your hard work on this.

Last edited by JTxt (2011-01-23 02:31:54)


http://scratch.mit.edu/static/icons/buddy/524717_med.png?t=2010-06-15+09%3A48%3A36

Offline

 

#2466 2011-01-23 03:28:37

14God
Scratcher
Registered: 2008-11-14
Posts: 100+

Re: BYOB 3 - Discussion Thread

JTxt wrote:

And it passed 65536 views!  smile
.

Funny... 65536 is the exact number of degrees in a circle on the Unreal Engine.


http://cs.berkeley.edu/~bh/sig4.png
Logic and reason have led me to atheism... but I'm stuck with the name  tongue

Offline

 

#2467 2011-01-23 04:36:43

xly
Scratcher
Registered: 2010-04-17
Posts: 100+

Re: BYOB 3 - Discussion Thread

@ Jens - Nested sprites

Your nested sprites application still works, although  we can't use it for designing. I'm still impressed by the taod example. As <broadcast > instruction is important to build such applications I have noticed that this instruction accepts a variable like <spritename> but does not accept the new object  <object sprite>.

Offline

 

#2468 2011-01-23 09:55:11

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Hi Xavier,

I'm not sure I understand what you mean by not being able to use BYOB's nested sprite feature for designing. There's a (much too short, I know) overview of how to design composites in the BYOB distro, you can find it at the end of the the file named 'BYOB 2.0.pdf'.

You're right, that currently there is no efficient way for a composite to address its parts and vice-versa. But we'll be able to change this with the new first-class sprites extension, by introducing new "system lists".


Jens Mönig

Offline

 

#2469 2011-01-23 14:33:27

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: BYOB 3 - Discussion Thread

My solution for the problem of not having 100 new blocks is the Panther CYOB function, along with BYOB.
There could be a choice.  You can choose either code or build.

Offline

 

#2470 2011-01-23 16:03:19

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

Re: BYOB 3 - Discussion Thread

scimonster wrote:

My solution for the problem of not having 100 new blocks is the Panther CYOB function, along with BYOB.

CYOB solves some problems, but in my view, not the 100-blocks problem.  Once you're programming in Smalltalk, your "palette" is all of the object hierarchy and all of their methods!

Instead, our approach is overloading the existing blocks.  We're already getting a lot more mileage out of the [< > OF < >] block than its original purpose.  We're going to squeeze more out of the SET block, too.  Etc.


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

Offline

 

#2471 2011-01-23 16:06:13

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: BYOB 3 - Discussion Thread

What is the code for the thing on a block like: [+] on it? I'm making a block that has that, but I don't have that code.

Offline

 

#2472 2011-01-23 21:43:57

14God
Scratcher
Registered: 2008-11-14
Posts: 100+

Re: BYOB 3 - Discussion Thread

Stored procedures will only execute on the owner  sad


http://cs.berkeley.edu/~bh/sig4.png
Logic and reason have led me to atheism... but I'm stuck with the name  tongue

Offline

 

#2473 2011-01-23 23:01:30

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

Re: BYOB 3 - Discussion Thread

14God wrote:

Stored procedures will only execute on the owner  sad

I don't understand what you mean.  Could you give an example or something?  Tnx.


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

Offline

 

#2474 2011-01-24 10:35:58

clintonhackers
Scratcher
Registered: 2010-04-27
Posts: 20

Re: BYOB 3 - Discussion Thread

Jens wrote:

Hi Xavier,

I'm not sure I understand what you mean by not being able to use BYOB's nested sprite feature for designing. There's a (much too short, I know) overview of how to design composites in the BYOB distro, you can find it at the end of the the file named 'BYOB 2.0.pdf'.

You're right, that currently there is no efficient way for a composite to address its parts and vice-versa. But we'll be able to change this with the new first-class sprites extension, by introducing new "system lists".

Thanks for the pointer to the 'nested sprites' documentation, Jens.  I couldn't figure out what 'nesting' was!  Now I at least sort of understand.  It's still a bit opaque to me, though.  A couple of quick questions (I know any time you spend answering questions like this taks you a way from 3.1, so feel fre to ignore me):

- I'm not sure the nesting UI is working for me (Ubuntu 10.l10, 3.0.8, scratch 1.4).  As I understand it, in the corral I click on a sprite & drag its icon on top of the sprite into which it should be nested.  There should be a moment when the UI sort of 'clicks', and the subsprite icon shrinks into the highlighted 'parent' (wrong word, i know).  I can't seem to make this happen, so it's hard for me to experiment. 

- After this the subsprite should just track its parent both in x,y  co-ordinates and in direction.  But what happens if its scripts give it independent motion instructions? ahh.. just tried it in toad...  very cool. 

- based on that:  instead of spawning zillions of bullets, could a game just nest a bullet in a gun (sorry, I hate these shooter games, but all my boys want to build them & they illustrate points so nicely...) and, on  say a keypress event shoot out from the gun, hit or miss, and then return invisibly to its starting location?  can it be temporarily unnested from a script, and then renest?  I guess that's something for first-order sprites.

thanks much as always,
matt

Offline

 

#2475 2011-01-24 10:44:27

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

Re: BYOB 3 - Discussion Thread

clintonhackers wrote:

As I understand it, in the corral I click on a sprite & drag its icon on top of the sprite into which it should be nested.

You don't drag from corral icon to corral icon.  You drag from the corral icon to the actual sprite on the stage in which you want to nest it.  (Counterintuitive, maybe, but the only combination that didn't already mean something else, I think.)

instead of spawning zillions of bullets, could a game just nest a bullet in a gun...

Nesting solves the problem of keeping the bullet in the gun until fired, but it doesn't solve the problem that kids want to fire a second bullet while the first bullet is still partway to the target.  For that you need more than one bullet.  The Scratch solution is to have, say, ten bullets that take turns in rotation.  It'll be easier to do it by spawning a new bullet for each firing


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

Offline

 

Board footer