[MWForum]Selecting a turtle randomly from a list
Wendy Petti
mwforum@lists.mathcats.com
Wed, 6 Aug 2003 10:12:15 -0400
Hi Lisa,
I'll answer the second portion of your message since Harvey did such a fine
job with the first portion.
A WHEN process does *not* stop when you move to a new page. But please
realize that it continues to apply to the original set of turtles you
activated. It does not automatically switch over to the "car" turtle on
the second page even though newly-activated procedures will address that
page2 "car" turtle. The WHEN process keeps running for the turtles on the
first page. Even if you launch your procedure again (the one containing
the "when" commmand) so that it will work with the turtles on the second
page, the first procedure will still be running on the first page unless
you cancel it. This could potentially cause some confusion.
I tested this just now by setting up two identical pages with turtles t1
and t2 and buttons to launch these two commands:
to check
when [touching? "t1 "t2] [announce [hi!]]
end
to drive
everyone [forever [fd 1]]
end
I clicked the "check" button on page1 and then the "drive" button. On
page2, I only clicked the "drive" button. I revisited page1 and the
"check" button was still depressed (the process was still running). I
returned to page2 and waited to see if the turtles (at different headings)
would bump into each other. While I was waiting, apparently the turtles on
page1 collided first, because eventually the "hi!" announcement appeared...
even though I was on page2 and had never clicked the "check" button on
page2. The page1 turtles had set off the announcement.
Please do keep this in mind. There are ways to deactivate procedures when
you no longer need them, using either CANCEL, STOPME, or SET, among other
methods. A helpful article in MWPro help tells how to do this: under
"Process Management: Stopping Processes." (I'm unable to access my MW
2.0_ help file right now but I'm sure the documentation is there
somewhere.)
Wendy
Wendy Petti
OWL's MicroWorlds in Action
http://mia.openworldlearning.org
Math Cats
http://www.mathcats.com
wpetti@mathcats.com
> By the way, our earlier glitch with the duplicated turtles
> across pages was solved when we discovered that the
> WHEN-TOUCHING code stopped (entirely on its own) when we went to
> a new page. And to think that I'd spent a week drilling in the
> fact that asking MicroWorlds WHEN was to be done once and only
> once! When we called this procedure (of WHENs) again after
> arriving at the second page, the game continued okay. Is this
> really the way it works? I'm still quite surprised.
>
> Thanks--
> Lisa Richter
> Lisa@CosmicThinkers.com
> _______________________________________________
> MWForum mailing list
> MWForum@lists.mathcats.com
> http://lists.mathcats.com/mailman/listinfo/mwforum
> attachments archived at:
> http://www.mathcats.com/mwforum/attachments.html
>