[squeakland] Multiple objects running the same script

Steve Thomas sthomas1 at gosargon.com
Sun Aug 28 23:11:12 EDT 2011


So from what I can tell about what you are trying to do the best way may be
to create "sibling copies" or your turtles.  This is done by either holding
down the shift key when you click on the copy icon in the halo or from the
menu in the halo there is an option to create siblings

That said there are a number of ways to reset things I can think of and
hopefully this is not too much info:

   1. You can create a script that executes the resets for all objects you
   want to reset
   2. Use the scripting tile "tell all contents" (found in the scripting
   category for playfields) to execute all scripts named "reset" (or whatever
   name you choose). Note, this will only go "one level deep" in a playfield.
   This will work if all objects you want to reset are in the playfield (but
   will not work for any objects embedded in a playfield in that playfield)
   3. Use the scripting tile "tell all siblings" Siblings are really neat.
   When you change a script in one sibling all siblings get the same script
   changes. So in effect they share a common set of scripts and variables, but
   can have different values for each siblings copy of a variable and different
   script states as well.
   4. If you are using a Book, you can make a page (and the entire book
   "revertible. In the book's menu is an option "save this page for later
   revert" which allows you to set the page (or book) as "revertible"  Which
   will save the current state of the page.  Then from the Book's menu you can
   choose "revert this page" or "revert this book".  You can also use the menu
   item in a script, by getting the halo for that menu item (ie: "revert this
   page") and drag the "fire" tile into a script.

Note: you can either create a button to reset the page (from a script
editors menu, there is an option: "button to fire this script" or you can
set a scripts status to "opening" which can be used to reset a page or a
book when that page or book is opened.

Stephen

On Sun, Aug 28, 2011 at 10:41 PM, R.D. Latimer <rdlatimer at gmail.com> wrote:

> Etoys-
>   I have a 'turtle' with a reset button (clears screen, sets position to
> random xy) and a drawpattern script with random colors.
>
> Can I create many copies of this turtle and run all the resets at once -
> re-positions all 'turtles' and clears the screen, and then run drawpattern
> all at once for all turtles?  Note that drawpattern needs to run only once,
> not constantly as with a timer.
>
> Thanks,
> Randy Latimer
>
> _______________________________________________
> squeakland mailing list
> squeakland at squeakland.org
> http://lists.squeakland.org/mailman/listinfo/squeakland
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakland.org/pipermail/squeakland/attachments/20110828/cc4b26da/attachment.html>


More information about the squeakland mailing list