Jump to content

Black List Not Working


You are about to reply to a thread that has been inactive for 1427 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.

Link to comment
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
Link to comment
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
Link to comment
Share on other sites

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
Link to comment
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
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1427 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...