[Thread Prev] [Thread Next]
Hi again,
There are two options:
If you need to run a random proc in a list, it doesn't matter if all the
procs of the list are executed after 4 runs, and it doesn't matter if procs
are executed more than once, and if you wish to run random procedures from a
list, repeatedly. Create a text box and try the procedure TESTA
to testa
run pick [proc1 proc2 proc3 proc4]
testa
end
to proc1
pr [this is proc 1]
end
to proc2
pr [this is proc 2]
end
to proc3
pr [this is proc 3]
end
to proc4
pr [this is proc 4]
end
*******
If you wish to execute the 4 procs of the list exactly once after doing 4
picks: first create the list of ordered procs to choose from. Then create
the list of mixed procs. Third, execute the list of mixed procs.
to testb
make "proclist [proc1 proc2 proc3 proc4]
make "mixedlist []
shuffle :proclist
run :mixedlist
end
In order to create the list of mixed procs, you must first make a decision
(pick a number between 1 and the number of procs you have in the list), put
that proc in the list of mixed procs, and lastly, remove that proc from the
list of available procs to choose from. Do that until the original list is
empty.
to shuffle :proclist
if empty? :proclist [stop]
make "pick 1 + random count :proclist
make "mixedlist fput item :pick :proclist :mixedlist
make "proclist remov item :pick :proclist :proclist
shuffle :proclist
end
to remov :item :list
if :item = first :list [op bf :list]
op fput first :list remov :item bf :list
end
-----Original Message-----
From: mwforum-admin@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
[mailto:mwforum-admin@xxxxxxxxxxxxxxxxxxxxxxxxxxxx]On Behalf Of zehava
wizman
Sent: February 6, 2007 12:57 PM
To: mwforum@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [MWForum] problem with touching command
Hi Alain!
thanks for your answer,the trick of writing fd 0 , did it!
I didn't know that the 2 turtles have to be in animation mode, inorder to
check collision.
to the second question about running procedures in random way, if for
example I have 4 procedures dealing with movement for four direction and
doing more things, the main procedure will activated the four procedures in
randomally order.
thanks, Zehava
Alain Tougas <alain@xxxxxxx> wrote:
Hi,
I can't be sure about what the problem is because my operating system
can't deal with the "special characters" in the name of the third procedure.
Therefore, this procedure is "not defined" and the butterfly cannot perform
the action it is supposed to do when touching the dancer.
Besides, I notice two potential issues:
1. If th ebutterfly is trying to run this "third" procedure which I
don't know the name of, then this procedure simply says: page3. You are
already on Page3. therefore, you will see NO effect for the collision.
2. The dancer has a "touching" instruction, but the "collision" will
only be detected if the dancer is moving. Collision detection does not work
"subjectively" for inanimated turtles. Only moving turtles can detect
collisions. In order to solve that, the dancer should do a FD 0. Moreover,
it should do that in "Forever" mode. Right now, it is in "Once mode".
Note that in the latest version of MicroWorlds EX (1.6), collision
detection occurs for any turtle, animated or not.
Alain
-----Original Message-----
From: mwforum-admin@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
[mailto:mwforum-admin@xxxxxxxxxxxxxxxxxxxxxxxxxxxx]On Behalf Of zehava
wizman
Sent: February 6, 2007 5:20 AM
To: help MW
Subject: [MWForum] problem with touching command
Hello Forum!
Here attached a project with butterfly that can go left and right, if
she is touching the dancer, there some actions happened. the dancer has in
the instruction the touching command,but even if touching occured, nothing
happened. WHY???
thanks, Zehava
--------------------------------------------------------------------------
Sucker-punch spam with award-winning protection.
Try the free Yahoo! Mail Beta.
----------------------------------------------------------------------------
--
Need a quick answer? Get one in minutes from people who know. Ask your
question on Yahoo! Answers.
Previous by thread:
RE: problem with touching command
Next by thread:
problem with launch command
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.
|