[Squeakland] Duplication Through Siblings

Scott Wallace scott.wallace at squeakland.org
Sat Feb 25 21:42:11 PST 2006

Hi, Ryan, and all,

[Ryan privately emailed me a copy of his project, on which this reply 
is based.]

The reason why you're getting an extra copy stuck to your cursor is 
because of this script, which in your project is used for making the 

"Cell8's copy" *already* makes a copy.  Telling *that* copy to "do 
menu item 'duplicate'" means:  do the same thing as if I were 
actually to have chosen the "duplicate" menu item from the halo menu 
of the first copy.

... which makes a copy (of the initial copy) and puts it on your 
cursor.  Precisely the phenomenon you're observing ;-)

So, in short, that single phrase in the "duplicate" script makes 
*two* copies, leaving one on your cursor.

The best idiom to use to make copies using scripts is to invoke 
"copy" to get the copy, and to use "include at end" or another of the 
"include" options to say *where* the copy should be put.

Thus, for example, here's a nice script which tells a cell to make a 
copy of itself and add to it to a container named Holder:

I'm attaching a reworked version of Ryan's "cell" project that makes 
use of this idiom.  Note also that this version puts the cells into a 
"holder" rather than into a simple "playfield," in order to make the 
results of each doubling of the cell population be more visually 


  -- Scott

At 10:22 AM -0500 2/25/06, Thompson, Ryan wrote:
>Good morning,
>I have set up squeak to create siblings or duplicates through a 
>script which is activated via a button. However, not only does it 
>create copies of the objects but it also puts a copy on my cursor. 
>How can I eliminate this pesky copy?
>Ryan Thompson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://squeakland.org/pipermail/squeakland/attachments/20060225/dd330bee/attachment-0001.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: P3CB7E45A_12
Type: image/png
Size: 28348 bytes
Desc: not available
Url : http://squeakland.org/pipermail/squeakland/attachments/20060225/dd330bee/P3CB7E45A_12-0001.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: P3CB7E45A_13
Type: image/png
Size: 26802 bytes
Desc: not available
Url : http://squeakland.org/pipermail/squeakland/attachments/20060225/dd330bee/P3CB7E45A_13-0001.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: %cells-sw.009.pr
Type: application/applefile
Size: 125 bytes
Desc: not available
Url : http://squeakland.org/pipermail/squeakland/attachments/20060225/dd330bee/cells-sw.009-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cells-sw.009.pr
Type: application/octet-stream
Size: 47217 bytes
Desc: not available
Url : http://squeakland.org/pipermail/squeakland/attachments/20060225/dd330bee/cells-sw.009-0001.obj

More information about the Squeakland mailing list