[Squeakland] Making a Copy of an eToy from a script and using the mouse pointer to activate an eToy script

Offray Vladimir Luna Cárdenas offray.luna at javeriana.edu.co
Mon Nov 13 08:21:36 PST 2006


Hey Scott!! :)

Thanks for your quick answer and sorry for my late response.

Scott Wallace escribió:

[...]

> When you execute "Car's copy", the result will be the creation of a 
> copy of Car (strictly speaking a "sibling", viz. a fellow instance of 
> the same class as Car.)
>
> However, if you don't *place* that copy somewhere, you won't see it.  
> The standard idiom for placing an object somewhere via script is to 
> tell the *container* in which you place it to "include" it.
>
> Here's a typical usage pattern:
>
>
> ------------------------------------------------------------------------
>
>
>
> ------------------------------------------------------------------------------ 
>
>

This works pretty good. I use the world as a container and now I have a 
lot of stars in the wold. At the beginning I thought it was not working 
because all starts were copied over the original one, but then I 
realized what was happening. There is still something I don't know how 
to do: how can I send a message to a particular copy. Suppose I have  
copied a Car and I have a script  for  the original one to make the car 
go forward and now I wan to make the recent copy to use that script. 
There is some natural number in each of the copies' names. Can I use it 
as a reference for the copies scripts to enable them?

>> Pdt: It seems that we're reaching some kind of stress point of the
>> eToys. Would be nice to have the possibility to go from them to their
>> code, but the scripts of the eToys seem to have only a code view, but is
>> not usable for writing new code.
>
> Hmm, well, etoy objects are first-class Smalltalk objects, and etoy 
> scripts are real, first-class Smalltalk methods, belonging to real, 
> first-class Smalltalk classes, and if you switch any script's Scriptor 
> to textual mode (by clicking on the checkbox in the Scriptor's 
> header,) you can enter any Smalltalk code you wish there.

[...]

> Textual coding can actually be done using two kinds of scripts:
>
> First, as mentioned above, you can write textual code for any existing 
> "etoy script" that you see in a Viewer by switching its Scriptor to 
> textual mode via the checkbox.

Thanks. I had not notice this possibility because when I go from tile to 
code mode in the scriptor and change a parameter (for example increase 
"self forward: 5" to 10) with the script ticking I see no change and I 
hope some similar behavior as I had seen in the tile mode, in which a 
change in the parameter has an instantaneous  response in the behavior 
of the object in the script changed was ticking. Today I probed pressing 
[Alt] + [d] and I see the changes. There is still a problem I can't 
figure out a work around. When I come back from code mode to tile mode 
in the scriptor the script is exactly the same, none of the changes made 
in code mode are stored. May be the problem is related on how the script 
behaves in tile and code modes and the user expecting a more 
similar/coherent behavior, and not with the possibilities of the eToys 
system.

>
> Secondly [and this is not so well known] you can open a conventional 
> Smalltalk browser on the class of an etoy "object", and using that 
> Browser you can not only see and edit the etoy scripts, you can also 
> add any other methods you wish, including methods with multiple 
> arguments (whereas etoy scripts are limited to 0 or 1 argument,) 
> mid-method returns, and many other things that you can't directly 
> obtain using tiles alone.  To get such a Browser, in the Viewer's menu 
> choose "more..." and from the auxiliary menu that pops up, choose 
> "browse class."

On this point this is what I get:

browser class

There is a #guión1 (#script1) but I don't know how to change scripts 
code or add new scripts. Any pointer to the documentation?


>
> A plausible practice is to use tile scripting for everything in a 
> project that *can* be readily done using tile scripts, then to 
> supplement this with conventional Smalltalk code in one or two places 
> where necessary.
>
[...]
>
> I'm not claiming that this is the ideal way to transition from e-toy 
> tile-scripting to full-scale Smalltalk, if that's what your goal is -- 
> indeed, it may lead to false expectations; I just wanted to make sure 
> you're aware of the availability of these two ways of blending 
> tile-scripting with writing unrestricted Smalltalk code.  It would be 
> interesting to hear of experiences people have had with this kind of 
> hybrid approach.

Yep, the idea is some kind of transition from e-toy tile-scripting to 
Smalltalk (may be not full scale yet, but with the idea of that scale in 
some moment of the process). I have bought the book "Squeak: learning 
with robots" from Steffane, because of its pedagogical advantages 
providing the robots as a way to "see" the effect of code (loops, 
conditionals, etc.), but others will come to Squeak from eToys and 
Bookmorphs (for interactive educational material), so making a bridge 
between them and Smalltalk would be a nice path to follow. I will keep 
you informed on the process of this approach ... and bothered with the 
questions it raise ;-)

> Cheers,
>
>  -- Scott
>

Cheers also from the country of the birds (well the second one). Anytime 
you want come, you must be aware: mi casa es tu casa (my home is your home),

Offray



More information about the Squeakland mailing list