View Full Version : World function "choose true"
Grindl
02-28-2008, 08:11 PM
I can't find any documentation about this. By using it in an IF statement, does it provide a way of randomly moving an object to one place or another? So if I set "choose true" to 0.5, it would take one branch of the IF statement 50% of the time, and the other branch the other 50%, in a random order?
If this is so, how it is counting to know that it is doing a 50-50 split? Is it from the start of play?
Is there a better way to randomly move an object to one place or another?
Thanks.
No, since with boolean logic it's either one answer or the other; there are none in between. What you could do is create a variable list in a world function you're using and set the variable type to boolean (with item0 = true, item1 = false).
So it would look something like this:
world.trueOrFalse
~
world.trueOrFalse No Parameters
[T/F]trueOrFalse = true,false
---
(Do Nothing)
return random item from trueOrFalse
So then your world.function would look like:
world.function
~
world.function No Parameters
No Variables
---
If world.trueOrFalse
method
Else
Do Nothing
Of course certain values will vary depending on your world. Hope this helps.
DickBaldwin
02-29-2008, 07:57 AM
I can't find any documentation about this. By using it in an IF statement, does it provide a way of randomly moving an object to one place or another? So if I set "choose true" to 0.5, it would take one branch of the IF statement 50% of the time, and the other branch the other 50%, in a random order?
If this is so, how it is counting to know that it is doing a 50-50 split? Is it from the start of play?
Is there a better way to randomly move an object to one place or another?
Thanks.
Go to Google and search for the following keywords:
baldwin alice random
Maybe some of what you find there will help.
Dick Baldwin
Free Alice tutorials: http://www.dickbaldwin.com/tocalice.htm
Free programming tutorials: http://www.dickbaldwin.com/toc.htm
Go to Google and search for the following keywords:
baldwin alice random
Maybe some of what you find there will help.
Dick Baldwin
Free Alice tutorials: http://www.dickbaldwin.com/tocalice.htm
Free programming tutorials: http://www.dickbaldwin.com/toc.htm
Do you post anything else besides links to your own tutorials?
DickBaldwin
02-29-2008, 10:19 PM
Do you post anything else besides links to your own tutorials?
In this case, which involved random movement, I posted the following:
"Go to Google and search for the following keywords:
baldwin alice random"
This is all the information that someone should need to find the answer to the question by doing a Google search. That search will expose an earlier forum posting containing the answer to the question.
So, yes, I do post other things when the answer to the question is not already contained in my tutorials. Frequently, however, if the question has already been answered in the tutorials, I simply make reference to the tutorials. Nothing more should be needed.
Actually, I suppose that I should have answered your question by simply telling you to go to Google Advanced Search and search for the following keywords, constraining the search to only return results from www.alice.org
baldwin alice
That should provide links for you to use to read everything that I have ever posted on the Alice forum.
Dick Baldwin
Free Alice tutorials: http://www.dickbaldwin.com/tocalice.htm
Free programming tutorials: http://www.dickbaldwin.com/toc.htm