PDA

View Full Version : random methods


iqforu
07-16-2006, 10:45 AM
Is there any way for Alice to perform random actions from a certain list of methods?
Another thing, is there a way for Alice to perform an action when something makes contact with another object?
thank you, iqforu

by the way, its Alice v2

lanceA
07-17-2006, 07:19 PM
I don't know the answer to your question but try and create your methods and then add the names of each method to a new LIST variable that you create. Then use ALICE's RANDOM function to select a named method from the list to call/invoke.

I've never done this, but at least this is a place to start!

Let us know how it works.

EdLaFave
07-17-2006, 11:05 PM
For the random method calls just do the following. Suppose there are 3 random methods you want to chose from. Use the random number function to generate a random number between 0 and 2. Then check to see what number is generated and call each method according to that number.

For collision detection have a loop that runs for infinity with an if statment that checks if object1 is within x meters of object2.

lanceA
07-18-2006, 07:02 PM
This is a GREAT way to do it ! Unless you have 5 or 12 or...... methods and you do NOT wish to hardcode how your random number generator accesses METHODS.

iqforu
07-24-2006, 11:12 AM
thank you, thank you
ill be sure to try those asap and tell you the results

JumpinJelly
07-26-2006, 05:12 AM
Wheres the random method? How to use?

gabe
07-26-2006, 09:58 AM
You can access the random function by clicking on the world level and clicking the function tab from the world's details. There are a couple random funtions listed which you can use in your method. (I hope this is what you are talking about!)

JumpinJelly
07-28-2006, 03:16 AM
Hmm.. how to set the random stuff? Must be some number or what right?
:confused: