Jump to content
You are about to reply to a thread that has been inactive for 74 days.

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

Recommended Posts

list List = ["n","n","13056ed9-7351-446d-b7ee-3152aeffed1a"];
default
{
    touch_start(integer total_number)
    {
        list TOUCHER = [llDetectedKey(0)];
        integer found = ~llListFindList(List,TOUCHER);
        if(found){llSay(0,"Found");llSay(0,(string)found);}
        else{llSay(0,"Not Found");llSay(0,(string)found);}
    }
}

Result when touched:
[14:37] Object: Not Found
[14:37] Object: 0

The integer that is reported should be 2, corresponding to my UUID in the list when it matches my UUID upon touching the object.

-1 means it was not found in the list by listfindlist.

As far as I know (found) should be triggered when the integer is not negative.

As you can see, it's not finding my UUID in the list and listing it's integer as 0... when it should be -1 for failed find or 2 for the list position.

I've been messing with this for a few days and am completely lost as to how to make it work.

Share this post


Link to post
Share on other sites
Posted (edited)

To be clear, I am trying to make a note card based UUID blacklist.

This code and post is just to figure out what the heck is going on with ListFindList. Because I'm baffled.

Edited by Rowan Afterthought

Share this post


Link to post
Share on other sites

Try

list List = ["n","n","13056ed9-7351-446d-b7ee-3152aeffed1a"];
default
{
    touch_start(integer total_number)
    {
        list TOUCHER = [llDetectedKey(0)];
        integer found = llListFindList(List,TOUCHER);
        if(~found)    // Or just if(found != -1)
        {
             llSay(0,"Found");
             llSay(0,(string)found);
        }
        else
        {
            llSay(0,"Not Found");
            llSay(0,(string)found);
        }
    }
}

or 

 

image.gif

  • Like 1

Share this post


Link to post
Share on other sites

Try it like this? Capturing it as a key, then listing it inside the function

 

list List = ["n","n","13056ed9-7351-446d-b7ee-3152aeffed1a"];
default
{
    touch_start(integer total_number)
    {
        key TOUCHER = llDetectedKey(0);
        integer found = ~llListFindList(List,[TOUCHER]);
        if(found){llSay(0,"Found");llSay(0,(string)found);}
        else{llSay(0,"Not Found");llSay(0,(string)found);}
    }
}

  • Like 1

Share this post


Link to post
Share on other sites

@Rolig Loon I did try it like that before...

Your suggestion returns:

[15:01] Object: Not Found
[15:01] Object: -1

Still not finding my uuid in the list, but at least it's got the right integer value for not finding it.

@Ruthven Ravenhurst I also tried your suggested layout before, but it also returns Not found and 0.

Share this post


Link to post
Share on other sites
Posted (edited)

When the list List is created the value is stored as a string, so when you look for the key returned by llDetecedKey a match is not found.

So, either specifically cast that key as a key when you create the list (which you can't in a global declaration, so you'd have to build the list in the state_entry event)

list List;
default
{
    state_entry ()
    {
        List = ["n","n", (key) "aa430197-791d-480d-90ed-5c0b4588416d"];
    }
    touch_start(integer total_number)
    {
        list TOUCHER = [llDetectedKey(0)];
        integer found = ~llListFindList(List,TOUCHER);
        if(found){llSay(0,"Found");llSay(0,(string)found);}
        else{llSay(0,"Not Found");llSay(0,(string)found);}
    }
}

or cast the return from llDetectedKey as a string when you search for it in the list.

list List = ["n","n","aa430197-791d-480d-90ed-5c0b4588416d"];
default
{
    touch_start(integer total_number)
    {
        list TOUCHER = [(string) llDetectedKey(0)];
        integer found = ~llListFindList(List,TOUCHER);
        if(found){llSay(0,"Found");llSay(0,(string)found);}
        else{llSay(0,"Not Found");llSay(0,(string)found);}
    }
}

Edit: Actually, you could globally declare that List like this:

key me = "aa430197-791d-480d-90ed-5c0b4588416d";
list List = ["n", "n", me];

 

Edited by KT Kingsley
  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
13 minutes ago, KT Kingsley said:

When the list List is created the value is stored as a string, so when you look for the key returned by llDetecedKey a match is not found.

Thank you for this!

With that in consideration, it is now working as expected. It's always the small nuances that I over look...

 

list List = ["n","8562eb25-0a93-4c6d-9a9e-380fb123a571","aa430197-791d-480d-90ed-5c0b4588416d","13056ed9-7351-446d-b7ee-3152aeffed1a"];
default
{
    touch_start(integer total_number)
    {
        list TOUCHER = [(string) llDetectedKey(0)];
        integer found = llListFindList(List,TOUCHER);
        if(found!=-1){llSay(0,"Found");llSay(0,(string)found);}
        else{llSay(0,"Not Found");llSay(0,(string)found);}
    }
}

13056ed9-7351-446d-b7ee-3152aeffed1a = my key.

Touching returns:

[15:36] Object: Found
[15:36] Object: 3

As expected.

Thank you everyone for your replys!

  • Like 1

Share this post


Link to post
Share on other sites

The limitations and extents of string/key interchangeability are one of those things nearly all of us learn about the hard way.

  • Like 2

Share this post


Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 74 days.

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...