Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Random Phrases

Louise Andrews
ask me, i just might!
Join date: 26 May 2005
Posts: 132
01-27-2006 03:15
Could someone point me in the right direction please.
I can write a basic script so that when someone touches a prim it says a phrase. On a second click, it says another phrase. What I'd like to have is a list of random phrases, and one is churned out by the prim on clicking it.
Any pointers much appreciated. My knowledge is basic but I'm willing to learn.

Thanks.
_____________________
Please visit:

Main store: Under review - please see Picks in World


SLBoutique

SLExchange
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
01-27-2006 06:45
http://secondlife.com/badgeo/wakka.php?wakka=list

Make you list and either use the randomise list function (slower) or pick a random integer between 0 and list length -1 e.g. llFloor(llFrand(llListLength(phrases)); and pull that element out of the list. Hope that's enough of a pointer - I'm happy to help more but about to leave work and a bit short of time atm.
Kintar Czukor
Registered User
Join date: 23 Jan 2006
Posts: 6
01-27-2006 07:41
Eloise's response will work, but for even more configurability (for example, if you want the user to be able to pick a list of phrases, but don't want them modifying your script), have your random-phrase script read from a notecard in the object's inventory. That way, the object's owner can drop in a notecard to change the script phrases, but doesn't have to modify any script to do so. (More privacy for you, and less chance of them screwing something up! :D)

The wiki link Eloise posted above is where you can start. Just hit the "Inventory" secion, and have a look at llGetNotecardLine and llGetNumberOfNotecardLines.

-- Kintar
Louise Andrews
ask me, i just might!
Join date: 26 May 2005
Posts: 132
01-27-2006 08:49
Thank you both very much for your replies. My script is now working beautifully!

Lou
_____________________
Please visit:

Main store: Under review - please see Picks in World


SLBoutique

SLExchange