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

#2201 2010-11-11 22:36:04

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

Re: BYOB 3 - Discussion Thread

fullmoon wrote:

Are you referring to the section where they talk about cat.prototype?

Yes.

PS It's all your fault that I'm not getting any real work done this week!  sad


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

Offline

 

#2202 2010-11-11 22:45:26

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

Re: BYOB 3 - Discussion Thread

nXIII wrote:

Code:

var myABC = new (myCar.abc)();

It's not the notation that's confusing me, with or without 'new,' but the semantics.  Abc appears to be defined as a method of car.  To have an abc that's not part of a car is like the Cheshire cat's smile, regardless of notation!  If you're going to want to instantiate abc independently, then it should be defined outside of car, and the car definition should instantiate or subclass it.

What am I missing?  Tell me in English, not code.  smile
Thanks.


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

Offline

 

#2203 2010-11-11 23:19:04

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

fullmoon wrote:

Are you referring to the section where they talk about cat.prototype?

Yes.

PS It's all your fault that I'm not getting any real work done this week!  sad

Well, to be honest, I've never really thought about what the prototype object means in any philosophical way. I don't think it creates a distinction between classes and instances, though, check out the Wikipedia page on prototype OOP for another JS example that uses the __proto__ object instead of constructor.prototype (like the last one). Here's an interesting discussion on the difference between the two.

And yes, I'll stop spamming your thread now.  smile  I've got what I need, and the closures are working nicely now.


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

Offline

 

#2204 2010-11-12 00:15:08

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

Re: BYOB 3 - Discussion Thread

nXIII wrote:

@bharvey, I made you a new signature! Like it?  big_smile

I do, but I changed it a little.  (Took me an hour or two; I don't think I understand transparency.  Or else Graphic Converter doesn't.  I finally found a way in Gimp but that wasn't easy either.  sad  )  Thanks!

PS What's with your sig?  Working for Google or something?

Last edited by bharvey (2010-11-12 15:55:20)


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

Offline

 

#2205 2010-11-12 00:32:48

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

Re: BYOB 3 - Discussion Thread

fullmoon wrote:

the Wikipedia page on prototype OOP

... makes absolute perfect sense to me.  This is exactly how Object Logo worked.  That cat example doesn't seem to me to have anything to do with it except that it uses the word "prototype"!

But I guess I should just learn JS from the beginning instead of jumping in in the middle.

PS  The Wikipedia discussion of delegation on that page you cited is interesting in light of our earlier conversation on the subject.

PPS  You're not spamming; you're helping me think about cloning sprites in BYOB 3.1.  smile


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

Offline

 

#2206 2010-11-12 17:14:26

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

Re: BYOB 3 - Discussion Thread

fullmoon wrote:

nXIII wrote:

fullmoon wrote:


What's FluxByte?

We're getting really off-topic, sorry....  hmm

No, I genuinely want to know!
(Don't worry...I've singlehandedly kept this thread off topic for days.)

It's nXIII and my (I know that's probably terrible mechanics) collaboration.

Offline

 

#2207 2010-11-12 19:07:10

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

Re: BYOB 3 - Discussion Thread

shadow_7283 wrote:

fullmoon wrote:

nXIII wrote:

We're getting really off-topic, sorry....  hmm

No, I genuinely want to know!
(Don't worry...I've singlehandedly kept this thread off topic for days.)

It's nXIII and my (I know that's probably terrible mechanics) collaboration.

Cool, what are you guys working on?


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

Offline

 

#2208 2010-11-12 20:42:00

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

Re: BYOB 3 - Discussion Thread

Stuff.  tongue  We're about to release our first project. Actually, we were supposed to a couple months ago, but we had more to do than we expected.

Offline

 

#2209 2010-11-12 21:24:21

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

Re: BYOB 3 - Discussion Thread

@shadow:  Hey, what did your parents say about meeting in Dallas during my conference (Sat 3/12/11)?

PS I know that sounds like a long time from now, but it affects whether I leave early that evening or stay until Sunday morning, so we have to settle it before I get my airplane tickets.

PPS By all means have them email me if they want to check me out, as in "why is this adult so interested in our kid?"

Last edited by bharvey (2010-11-13 00:08:25)


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

Offline

 

#2210 2010-11-13 10:46:19

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

Re: BYOB 3 - Discussion Thread

I discussed it briefly with my dad earlier, but we didn't really make any final decisions. I'm sorry if it's been an inconvenience to you.  sad  I'll talk about it more when he gets home from Germany (he's on a business trip).

Offline

 

#2211 2010-11-13 11:17:33

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

Re: BYOB 3 - Discussion Thread

shadow_7283 wrote:

I discussed it briefly with my dad earlier, but we didn't really make any final decisions. I'm sorry if it's been an inconvenience to you.  sad  I'll talk about it more when he gets home from Germany (he's on a business trip).

OK, thanks, it's not that urgent, it just can't wait until the last minute.


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

Offline

 

#2212 2010-11-15 15:56:53

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

Re: BYOB 3 - Discussion Thread

In order to avoid bumping this topic, let me propose a challenge that just occurred to me but I haven't really thought about it much:

     Let's invent prototype-based programming in BYOB!

big_smile
Any thoughts?

Oh, and unrelated request: I find it slightly annoying to do this:
Key "->" Value
to mean this:
Key -> Value
And then not be able to edit the block spec without first deleting the "-" portion.

Last edited by nXIII (2010-11-15 16:00:13)


nXIII

Offline

 

#2213 2010-11-15 20:44:51

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

Re: BYOB 3 - Discussion Thread

nXIII wrote:

Let's invent prototype-based programming in BYOB!

Yes, let's. And then I can add a section about it in this BYOB-OOP tutorial I'm writing!


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

Offline

 

#2214 2010-11-16 02:14:18

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

Re: BYOB 3 - Discussion Thread

nXIII wrote:

Let's invent prototype-based programming in BYOB!

Hint:  That Wikipedia article fullmoon pointed to about prototyping says that the key to making it work is delegation.

So you just put a clone-myself method in the parent, and you put an instance variable whose value is (ask parent 'clone-myself) in the child, and you're in business!

Key -> Value

You should just be able to type this in the first place, and it certainly shouldn't give a Squeak error.  http://byobugs.com  smile

EDIT:  Since nobody's responded to this, let me add a comment...  Of course what you really want is to be able to define a PARENT block that only works inside an object definition, takes an object FOO as input, and inserts the blocks

Code:

SCRIPT VARIABLES <my-FOO>
SET <my-FOO> TO [ASK <FOO> <clone-myself>]

into the object definition in place of itself.

Saying that another way, you want macros.  So do I; in my negligible free time I'm trying to figure out how to design a UI for it.  One problem is that, as in my example, you want to be able to construct variable names such as my-FOO.  That means you have to be able to drop a JOIN block (or, by extension, any reporter) onto an orange blob of a SCRIPT VARIABLES to allow the name to be computable at runtime.  (Jens is wincing as he reads this, I'm sure.)

EDIT 2:  No, what you really really want is a way to add a method or state variable to an object that already exists.  The easy part is using a table of methods inside the object instead of individual IF blocks for each message, and having a method to add methods to the table.  The hard part is making all the object's methods/variables available to the script of your new method!  But I guess if there's a GET <name> method in the object that gets table entries, that might do.

Last edited by bharvey (2010-11-17 00:48:20)


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

Offline

 

#2215 2010-11-17 00:44:07

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

Re: BYOB 3 - Discussion Thread

News flash: I made an object that can clone itself, but after I run the project, if I try to save it BYOB freezes halfway through the save.  Stay tuned...


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

Offline

 

#2216 2010-11-17 17:20:30

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

Re: BYOB 3 - Discussion Thread

@bharvey

I'm working on a mini-RPG application with many characters, objects, rooms etc. I've found out interesting Byob features, new to me, simplifying the management of a crowd of sprites.

1 - for each sprite SPRITEX, you define a local variable NAME set to the name of the sprite, SPRITEX for example. As this variable is Local you can get the name of this sprite with <name OF sprite >
- in parallel you define a Global variable SPRITEX having also the name of the sprite.
Then, you can get the distance of any sprite with : DISTANCE TO [<name > OF ANYSPRITE]

2 - If you define a BROADCAST for each sprite having the name of the sprite you can pass the variable SPRITEX to BROADCAST. For example, to send a broadcast to several Sprites : FOR EACH ITEM OF LIST OF SPRITES, BROADCAST ITEM # OF LIST

3 - If you define for each sprite a method, named CO-SPRITEX, you can write :

SCRIPT VARIABLE a b
SET <b> TO SPRITEX
SET <a> to JOIN CO- <b>
RUN <a> OF <b> WITH INPUT ...

It means that you can execute "parametrable " methods by using JOIN

These features offer interest :
a - to handle a large group of sprites with LOOP instructions (MAP, FOR EACH, etc)
b - to define  "objects" of a sprite in a generic manner (functions, scripts, methods, variables) this reducing the time of "adaptation" to customize a new duplicated sprite.

Offline

 

#2217 2010-11-17 18:28:50

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

Re: BYOB 3 - Discussion Thread

xly wrote:

for each sprite SPRITEX, you define a local variable NAME set to the name of the sprite

Yeah, we thought about providing a primitive block that reports the name of the sprite.  But it's sort of a half-feature; really the sprite itself should be a first class value.  Wait for 3.1.  smile

Last edited by bharvey (2010-11-17 18:29:06)


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

Offline

 

#2218 2010-11-21 03:39:59

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

Re: BYOB 3 - Discussion Thread

@bharvey

I've uploaded (see http://www.xleroy.net/ByobTuto/thumbnails.html ) a new application RPG . It extensively uses the function CO with 4 parameters. 1st = name of the sprite which will execute the instruction; 2nd = instruction code, for example gt for GOTO, say for SAY ; 3rd and 4th parameters needed by the 2nd parameter.Byop functions are either Global or Local to one sprite. Here CO is "dedicated" to any selected sprite, this allowing any sprite to act on any other sprite.

RPG uses also PROPERTIES reporter function as explained in your Byop OOP tutorial.

Offline

 

#2219 2010-11-21 03:59:51

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

Re: BYOB 3 - Discussion Thread

@bharvey
(.../...)

One RPG is a sequence of several scenes chained by a global scenario. Each scene in itself is a "game". It is impossible to keep all these games in the Byob memory. Thus  I've started to see how to export the sprite Hero with its properties from the Act I into a second application Act II. The "export" function of Hero sprite fails "Could not write file. Export failed".

It is not blocking, as the few properties values of Hero at the end of Act I can be saved into a text file to be re-imported at the beginning of Act II.

Offline

 

#2220 2010-11-23 01:57:59

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

Re: BYOB 3 - Discussion Thread

Okay, I'll look at xly's program and JD1's program just as soon as things slow down at work.  And I'll perfect my prototyping OOP code, too.  It may be a week or two, though; this is the end-of-semester crunch.


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

Offline

 

#2221 2010-11-24 10:03:57

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

Re: BYOB 3 - Discussion Thread

@bharvey

In the meantime I've renamed CO to FOR and updated it. Its syntax is now :
FOR <spritename>DO <action code> <param1> <param2> .

Offline

 

#2222 2010-11-28 22:24:22

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

@shadow:  Hey, what did your parents say about meeting in Dallas during my conference (Sat 3/12/11)?

PS I know that sounds like a long time from now, but it affects whether I leave early that evening or stay until Sunday morning, so we have to settle it before I get my airplane tickets.

PPS By all means have them email me if they want to check me out, as in "why is this adult so interested in our kid?"

I'm SO sorry Brian (I guess it's OK if I call you that), but I can't come. I know this is going to sound like an empty apology, but I was really looking forward to meeting with you.

I actually brought up the Dallas conference with my dad on numerous occasions (I hadn't forgotten about it). We still hadn't had the time to plan ahead and make final decisions, and then my dad booked flights for a trip to New Zealand for three whole weeks. Unfortunately (I didn't realize it at the time) our trip was to be going on March 12.

We haven't gone to New Zealand (the country of my birth) in four years, and my dad jumped on the opportunity when fare prices dropped.

I'm really sorry, especially if this has been an inconvenience for you.  sad

Offline

 

#2223 2010-11-29 10:22:53

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

Re: BYOB 3 - Discussion Thread

shadow_7283 wrote:

I'm SO sorry Brian (I guess it's OK if I call you that), but I can't come. I know this is going to sound like an empty apology, but I was really looking forward to meeting with you.

Bummer!  I'm sorry, too.  But of course your family's needs come first.  You'll just have to find a way to visit Berkeley at some point.  smile


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

Offline

 

#2224 2010-11-29 18:22:29

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

Re: BYOB 3 - Discussion Thread

Definitely! Possibly when I transfer in LA...?  big_smile 

Maybe next year.

Last edited by shadow_7283 (2010-11-29 18:22:43)

Offline

 

#2225 2010-11-29 18:45:40

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

Re: BYOB 3 - Discussion Thread

shadow_7283 wrote:

Maybe next year.

Ah, but next year the conference won't be in Dallas.  sad


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

Offline

 

Board footer