Jump to content

llListFindList() troubles (i think)


Tabris Daxter
 Share

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

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

Recommended Posts

Hey all,

i think the problem i'm having with script is in the llListFindList() but it may be in how the lists are made & extracted

string gNoteCard = "Settings";
integer gNCline;
key gNCquery;
list pID;
key pCUT;

default
{
    state_entry()
    {
        llOwnerSay("DMZ Location Test\nTouch to load locations");
        llListen(1,"",llGetOwner(),"");
    }

    touch_start(integer total_number)
    {
        gNCquery = llGetNotecardLine(gNoteCard, gNCline);
    }
    
    listen(integer chan, string name, key id, string msg)
    {
        if (msg == "Dump")
        {
            llOwnerSay(llDumpList2String(pID,"\n"));
        }
    }
    
    dataserver(key lquery, string data)
    {
        if (gNCquery == lquery)
        {
            if (data != EOF)
            {

                list tmp = llParseString2List(data, ["="], []);
                string setting = llList2String(tmp,0);
                if (setting == "DMZ")
                {
                    pID += llStringTrim(llList2String(tmp,1),STRING_TRIM);
                }
                else if (setting == "AUTH")
                {
                    pCUT = llList2Key(tmp,1);
                }
            }
            gNCquery = llGetNotecardLine(gNoteCard, ++gNCline);
        }
    }
    
    changed(integer intnull)
  {
    if (intnull & CHANGED_TELEPORT)
    {
        llOwnerSay((string)llGetListLength(pID) + " Items Loaded");
          list temp = llGetParcelDetails(llGetPos(),[PARCEL_DETAILS_ID]);
          key Pkey = llList2Key(temp,0);
          integer pIndex = llListFindList(pID,temp);
          llOwnerSay("DEBUG "+ (string)pIndex + "\n"+llList2String(pID,pIndex) + "\n" + llList2String(temp,0));
          if (Pkey == llList2Key(pID,pIndex))
          {
              llSetColor(<1,0,0>,ALL_SIDES);
              llSetText("Non-Combat Area",<0,0,1>,1);
          }
          else
          {
              llSetColor(<0,1,0>,ALL_SIDES);
              llSetText("Combat Area",<0,0,1>,1);
          }
    }
}
}

 Notecard:

DMZ=5ba1aa40-632e-23cf-dfc3-196ccb0739c2
DMZ=37178dfd-13b4-09b9-cf1e-c7ec51b8752b
DMZ=af79b520-aee5-1327-e50e-ac2a3c25f85f
DMZ=c8cf9757-2f41-9c04-c98e-8dace645eefa
DMZ=c8cf9757-2f41-9c04-c98e-8dace645eefa
DMZ=e9604890-dd25-9665-b44a-2424555ee256
DMZ=01dfd8ce-1340-cbc6-cbaf-748bfd11d2bf
DMZ=db9a6f90-7b4f-13ae-f2ee-daca09cd1408
DMZ=bfd20b35-0c1d-e4f2-032a-101fba92ae21
DMZ=f52d5722-e5af-f4df-488d-e5c2e975b98b
DMZ=158b5788-61ac-3f5a-0af1-68a611267d90
DMZ=5ae3d4d4-24c9-3653-dbed-8e49962d249f
DMZ=6be037e8-c84f-25aa-9ba5-8e15f8f7ff63
DMZ=bc7628a7-b806-bcf4-33d6-085270cd8532
DMZ=95e4d71b-622f-1d3d-5c8a-350b82e93146
DMZ=3785be47-ea15-5540-8ec3-67d225bbb4f1

 

Link to comment
Share on other sites

I suspect that whatever problem you're having is to do with the fact that sometimes it matters if something is cast as a key or a string and sometimes it doesn't, and when you're doing comparisons in lists, it does matter.

Since you are reading a notecard, everything's going to start out as string anyway, and you seem to be leaving things as strings with 

 pID += llStringTrim(llList2String(tmp,1),STRING_TRIM);

However, in the changed event, you're explicitly casting Pkey as a key

  key Pkey = llList2Key(temp,0);

and then trying to find a key in a list of strings, and that won't work.

I think if you say string Pkey = llList2String(temp,0); you should find it.

Link to comment
Share on other sites

Innula's right.

This is incorrect format to begin with:

if (setting == "DMZ")                {                    pID += llStringTrim(llList2String(tmp,1),STRING_TRIM);                }

Should be:

if (setting == "DMZ")                {                    pID += [llStringTrim(llList2String(tmp,1),STRING_TRIM)];                }

So try this instead:

if (setting == "DMZ")                {                    pID += [(key)llStringTrim(llList2String(tmp,1),STRING_TRIM)];                }

 

  • Like 1
Link to comment
Share on other sites

Hello, if I may add, I think your gNCquery inside the database event should be inside the if condition and not outside, in order to stop the loop once it reached EOF.

While it won't prevent the rest of the script from working normally, I'm sure you don't want a then useless infinite loop making several database requests per second once the whole notecard has been read.

  • Like 1
Link to comment
Share on other sites

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