Jump to content

Comparing a list of keys to UUID


CampSoup1988
 Share

You are about to reply to a thread that has been inactive for 4782 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Ok, i am trying to compare a list of keys and trying to match the person clicking on the object to someone on the list

 

 

key dk;
list UserList;

//stuff happens

dk = llDetectedKey(0);

if(llListFindList(UserList,(list)dk) >= 0){
    //stuff happens if user is on the list
}

 

Even though the UUID of the person is clicking, the llListFindList reports -1

 

Can someone help me?

 

Thank you,

CampSoup1988

Link to comment
Share on other sites

if the list of keys is hard coded into the script, then they will be of type STRING, and you'll need to convert the detected key to a string before testing it, like [(string)llDetectedKey( x )], or alternatively, you can run list replace on the string at start up, reading each value, converting it to key and replacing the oringinal

if you are building the key list from an outside source, use [(key)text_key_goes_here] instead of (list)((key)text_key_goes_here) to add them to the list, and then check for them with [key_to_match] instead of (list)key_to_match

 

why do it that way? because there's a bug in the LSO parse routine that will ignore the key typing for lists so it's better to use the list constructor [] instead of the list cast (list).... there'a a jira on this somewhere by strife

Link to comment
Share on other sites

I made an assumption above that may not have been clear, so I corrected it...

when reading UUIDs from an outside text source, you first have to cast them to key before using the list constructor to add them to the list... I think [(key)text] is enough, but if not you may want to assign the text to a variable declared as a key type, and then use the list constructor on that... eg

key vKeyTmp = incomming_text;
vLstMyList += [vKeyTmp];

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4782 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...