Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help with comparing values

Cyanide Nishi
Registered User
Join date: 6 Aug 2007
Posts: 2
08-06-2007 16:39
I am pretty new with lsl so pls be gentle with me. :)

Is there efficient way to compare integers and return the highest one without using many if statements? I'm writing a script to give free animal pictures and I need to know what one is the most popular. There will be five integers, horse, bird, dog, cat, and mouse. The value of the integers will be determined by the number of times they're selected (I have this part all figured out), so I just need an efficient way to compare the five and return the one selected most often. Is it possible to use something like LIST_STAT_MAX ? Thank you for help.
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
08-06-2007 17:00
You could use: llListSort

http://rpgstats.com/wiki/index.php?title=LlListSort

It would sort all the numbers. You'd probably want to make it a strided list for your purposes.
Cyanide Nishi
Registered User
Join date: 6 Aug 2007
Posts: 2
08-06-2007 19:21
Thank you for the suggestion. It worked perfectly!