Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llListFindList

Jenn Yoshikawa
Registered User
Join date: 14 Nov 2007
Posts: 91
11-10-2008 02:54
This kinda sucks I'm trying to find keys in a list. But I suck at lists so what am I doing wrong on this one?


list owners=["ea7516ac-7e14-4785-b117-3a4706f6292f"];

default
{
touch_start(integer total_number)
{
key detectedKey;
integer i;
for (i = 0; i < total_number; i++)
{
detectedKey = llDetectedKey(i);
if(llListFindList(owners, [detectedKey]) >= 0)
{
llOwnerSay("Bingo";);
}
else
{
llOwnerSay("Nope";);
}
}
}
}
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
11-10-2008 04:16
I guess the problem is that you're comparing a string against a key.

list owners=["ea7516ac-7e14-4785-b117-3a4706f6292f"]; // is a string (although, it looks like a key)

llListFindList(owners, [detectedKey]); // looks for a key in your list.


either do this:

list owners=[(key)"ea7516ac-7e14-4785-b117-3a4706f6292f"];

or this:

llListFindList(owners, [(string)detectedKey]);


This only applies, if you're entering the keys manually.
If you store the keys in the list via script, you don't have to do the typecast.
e.g. list owners = [llGetOwner()];
Arcane Clawtooth
5 By 5
Join date: 7 Jan 2008
Posts: 201
11-10-2008 10:12
Also, try this, looks nicer :)

if(llListFindList(owners, [detectedKey]) != -1)
_____________________
Visit Clawtooth Creations for all (well, a few) of your decorating needs.

Hey, check out the occasional picture in my flickr page. http://flickr.com/photos/30584092@N03/

Ok, I really need to finish something someday *sigh*
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-10-2008 15:53
If you are going to be using touch in your final script to determine who the person is and if they are in your list then you can forgo the use of keys and just use their names instead:
CODE

list owners =["Jesse Barnett"];

default {
touch_start(integer i) {
if (~llListFindList(owners,[llDetectedName(i)])) {
//if(~ is a bit of bit wise magic which in this case reads directly as; if( etc, etc != -1)
llOwnerSay("Bingo");
}
else {
llOwnerSay("Nope");
}
}
}
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum