Jump to content

Help with llList2List function please please?


Moon Corrigible
 Share

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

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

Recommended Posts

Apparently I am loosing my mind.  I can not for the life of me figure out what I am doing wrong.  The llSay funcitons are only there to help me figure out what I am doing wrong.

I am using this code:

    list person = llList2List(SECOND_INFO, 1, 1);


    llSay(0, "the second list item on the list is " + (string)llList2List(participants, 1, 1));
    llSay(0, "person is " + (string)person);
    llSay(0, "the first value is " + (string)llListFindList(participants, person));
    
    if(llListFindList(participants, person) != -1 && llGetListLength(participants) > 1)  //SECOND is participating
    {
        llSay(0, llKey2Name(llList2Key(SECOND_INFO, 1)) + " is second and is participating.");

}

 

And I am getting back this:

 

[08:57] Club Sofa: the second list item on the list is 2cf699db-acba-4fa0-8d4f-cc30fb438af9
[08:57] Club Sofa: person is 2cf699db-acba-4fa0-8d4f-cc30fb438af9
[08:57] Club Sofa: the first value is -1

 

OK.. so the second person on the list of participants is 2cf699db-acba-4fa0-8d4f-cc30fb438af9.  Good.

And the person I am looking for is 2cf699db-acba-4fa0-8d4f-cc30fb438af9.. good that is the same person!  So that person is on the list right?

 

[08:57] Club Sofa: the first value is -1

 

What do you mean no?  I swear sofa I have a screw driver and I am NOT afraid to use it!!

 

Link to comment
Share on other sites

In your third llSay() you are using llListFindList()....and it's correctly returning the index of the (not) found item (since it isn't a list being passed in for person.)

 

Try

llSay(0, "the first value is " + llList2String(participants, llListFindList(participants,[person])));

 

 

Link to comment
Share on other sites

You don't show us the lists, of course, but I have just tried this, and it works as expected:

 

default{    state_entry()    {        list participants=[NULL_KEY,"23b037cf-7c2a-4b8f-8f8d-563e5301d533"];        list SECOND_INFO = [NULL_KEY,"23b037cf-7c2a-4b8f-8f8d-563e5301d533"];        list person = llList2List(SECOND_INFO, 1, 1);        llSay(0, "the second list item on the list is " + (string)llList2List(participants, 1, 1));        llSay(0, "person is " + (string)person);        llSay(0, "the first value is " + (string)llListFindList(participants, person));        if(llListFindList(participants, person) != -1 && llGetListLength(participants) > 1)  //SECOND is participating        {            llSay(0, llKey2Name(llList2Key(SECOND_INFO, 1)) + " is second and is participating.");        }    }    touch_start(integer total_number)    {        llSay(0, "Touched: "+(string)total_number);    }}

 

Link to comment
Share on other sites

Buuutt the person is in the list.. they are the second entry on the list

    llSay(0, "the second list item on the list is " + (string)llList2List(participants, 1, 1));
    llSay(0, "person is " + (string)person);
    llSay(0, "the first value is " + (string)llListFindList(participants, person));
   

[08:57] Club Sofa: the second list item on the list is 2cf699db-acba-4fa0-8d4f-cc30fb438af9

[08:57] Club Sofa: person is 2cf699db-acba-4fa0-8d4f-cc30fb438af9

[08:57] Club Sofa: the first value is -1

 

Since the second entry is the same as the value I am looking for, the llListFindList function should return a 1 shouldnt it?

Link to comment
Share on other sites

The type of the list elements is unknown to me since i dont see how you build them up.

If you search a key in a list of strings or vice versa you will not find anything and an uuid can be stored as a string or a key.

You probably want to make an info output using llGetListEntryType.

Link to comment
Share on other sites

Just out of curiosity, why are you using llList2List here at all?  I would normally write

string person = llList2String(participants,1);

From which the reverse will always be true:   llListFindList(participants, [person]) = 1.

 EDIT:  Unless, as Nova points out, you have stored participant list entries as keys instead of strings.....  ;)

Link to comment
Share on other sites

Oh oh oh that is probably it!  I've had to divide this script so many times ( it is four scripts now - started as one) to keep it from running over that I honestly dont even remember how I load up that value.  Dollars to donuts one of them is a string and one is a key.  THANK YOU!!

Link to comment
Share on other sites

OK backtracking..  this is a couch that seats four and will let any combination of the four cuddle - so 3 and a single, two couples, four singles, whatever, after being granted permission by the cuddlers.  The portion of the script that is breaking my heart is the one that moves people around on the couch so that they can cuddle - slides person B down so that person A and person C can cuddle - that sort of thing.

 

The participant list is being passed over in a CSV from the permissions script.

.... and the value for the SECOND_INFO list is a key!!  HALLELUIA  I know why I am an idiot!!  ..wait..

 

THANK YOU ALL!  I never would have figured that out on my own.  I've been kicking it for 2 days.

 

And Rollig's suggestion, works like a charm.. you are a GODDESS amoung women!!  THANK YOU!!

 

Link to comment
Share on other sites

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