Project Folders
Teacher Resources
Student Resources
How Do I?
Site Map
Our Team

MWForum Message [Date Index] [Threads] [Authors] [Attachments] [Subscribe]

[Thread Prev] [Thread Next]

To: mwforum@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Subject: Re: MicroWorlds EX OnTic field in turtle's backback
From: "Daniel Ajoy" <dajoy@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 30 Apr 2006 11:56:55 -0500

On 30 Apr 2006 at 12:15, Nadia Bluhm wrote:

> Is there any easy way to run different procedures at different times 
> using the OnTic in the turtles backpack.  I know you can put a value in 
> the OnTic and run a procedure every so many 1/10th of a second, but 
> what if you want to run different procedures at different times?
> thanks in advance,  Nadia

Hi Nadia,

This is my first attempt to send, not a project, but a single turtle as
attachment. We can do that with EX.

For all those that don't have EX here is the code:

The turtle has this private variable:

I have 


It has this code when the user clicks on it once:

onClick once
settime 0

And it has this code as it's OnTick instruction:

OnTick 2/10 second

The private procedure is:

to alternate
if 0 = remainder time 10 [rt 90]
if 0 = remainder time 30 [bk 20]
fd 1
settime time + 1

The variable "time" is incremented every 2 tenths
of a second.

When "time" is 0

remainder time 10 

is 0 so rt 90 is run. That will not happen
when time = 1,2,3,4,5,6,7,8 and 9

but since 

remainder 10 10 

is 0 again, that is when "rt 90" will run again.


OpenWorld Learning

Attachment: t1ExAlternate.mwa
Description: Binary data

  • Previous by thread: MicroWorlds EX OnTic field in turtle's backback
  • Next by thread: Re: MicroWorlds EX OnTic field in turtle's backback

  • To save an attachment to your computer, PC users should right-click (Mac users, click and hold the mouse button) on the link and then choose 'save target as' from the pop-up menu. A window will then pop up in which you can choose a location for the file.

    © copyright 2001 - 2008