[Squeakland] make sibling from script

Scott Wallace scott.wallace at squeakland.org
Mon Aug 8 17:15:55 PDT 2005


Hi, Randy,

If you are placing your new object in a "Holder-like" container, then 
whatever x and y coordinates you give the object are irrelevant, 
because Holders lay out their contents left-to right and 
top-to-bottom, sort of like words get laid out in lines on a page in 
typesetting.

If, on the other hand, you are placing your new object in a container 
that is behaving more "Playfield-like," then objects will stay 
exactly where you place them, and in such cases, you can simply 
directly set the desired x and y coordinates in the script that 
creates the new object you are adding.

A common usage pattern is to place the newborn in a player-valued 
variable so that you can then talk to it in your script.  In the 
following example, a new sibling of amoeba is created and added to 
the world at an offset of (50, 100) from the original amoeba:

      amoeba's betterHalf <- amoeba's copy.
      amoeba's betterHalf's x increase by 50.
      amoeba's betterHalf's y increase by 100.
      world include-at-end amoeba's betterHalf

At the Wednesday "intermediate etoys" session at Squeakfest this 
week, let's plan on working through a complete example of this sort 
-- that will be very instructive!

Cheers,

   -- Scott


At 2:20 PM -0500 8/8/05, Randy Heiland wrote:
>Scott, 
>Extending this further, I'd then like to be able to place the newly 
>created sibling at a specified location in the container/playfield. 
> Since it's so close to Squeakfest, you can wait and educate me in 
>person if you want.  I did see there was also an "include at cursor" 
>tile on the Playfield which I'm assuming would be used to do this 
>placement, but not sure how I might use it successfully.
>
>--Randy
>
>
>From: Scott Wallace [mailto:scott.wallace at squeakland.org]
>Sent: Friday, August 05, 2005 4:05 PM
>To: Randy Heiland
>Cc: 'squeakland.org mailing list'
>Subject: Re: [Squeakland] make sibling from script
>
>Hi, Randy,
>
>Yes, it's called "copy", and it can be found in the "miscellaneous" category.
>
>When you execute "Car's copy", you'll end up with a sibling of Car.
>
>However, if you don't *place* it 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.
>
>Look in the "collections" category of the container's viewer for 
>various ways to "include" an object
>
>Here's a typical usage pattern:
>
>
>
>Cheers,
>
>   -- Scott
>
>At 10:18 AM -0500 8/5/05, Randy Heiland wrote:
>
>>Is there a tile to create a sibling of an obj?  Given that a search on
>>'sibling' only turned up 1 tile, I'm guessing not.  But it'd sure be nice!
>>:)
>>
>>--Randy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://squeakland.org/pipermail/squeakland/attachments/20050808/a5d282ca/attachment-0001.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001_5.jpg
Type: image/jpeg
Size: 6090 bytes
Desc: not available
Url : http://squeakland.org/pipermail/squeakland/attachments/20050808/a5d282ca/image001_5-0001.jpg


More information about the Squeakland mailing list