Lewis Nerd
Nerd by name and nature!
Join date: 9 Oct 2005
Posts: 3,431
|
11-30-2005 00:04
What I want to do is make a script so that when you "touch" an object, it will do randomly one of three things.
I know how to do the "if .. then .. else" bit, it's the random number generator thing I'm having trouble with, to pass that random number into a variable to act on.
Does that make sense? If so, could you help me please?
Thanks.
Lewis
|
AJ DaSilva
woz ere
Join date: 15 Jun 2005
Posts: 1,993
|
11-30-2005 00:29
variableName=llFloor(llFrand(3)); Should give you a value of wither 0, 1, or 2. Test it first though - I've been known to get really dumb things wrong when I've been up all night (which I have). 
|
Willow McGettigan
Registered User
Join date: 30 Nov 2005
Posts: 7
|
11-30-2005 01:23
remember, too, to make this a global variable if you're going to use that value in multiple states.
|
Harris Hare
Second Life Resident
Join date: 5 Nov 2004
Posts: 301
|
11-30-2005 06:50
From: AJ DaSilva variableName=llFloor(llFrand(3)); Should give you a value of wither 0, 1, or 2. Test it first though - I've been known to get really dumb things wrong when I've been up all night (which I have).  Wouldn't that have the potential of sometimes (although rarely) returning a value of 3 also? Or does llFloor somehow prevent that?
|
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
|
11-30-2005 07:10
From: Harris Hare Wouldn't that have the potential of sometimes (although rarely) returning a value of 3 also? Or does llFloor somehow prevent that? There is some uncertainty on the llFrand page, but the general consensus (and just about every other RNG known to man, woman or fish) says that 0 may be generated (albeit very rarely), but 3 never will. "0.0 <= return value < max"
|