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

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

Recommended Posts

Posted (edited)

I just can't see where the prob is.. trying to add json to LsD but I seem to be hitting a delay... or...?

the list just won't populate...

just drop it into a box ... it should populate the access lisst on state_entry, but...

key key_a = "0f13b999-92b1-4b6c-81a1-137a7f71d846"; // Radioactive Rosca
key key_b = "144fc2d4-c92d-4a3e-ae49-a8e4ae5c6950"; // MissMachine Resident
key key_c = "7932d074-c9d6-408f-b602-96be57d3d6db"; // Gleesa Silversmith
key key_d = "ba2b2be3-3cb4-4b44-ba02-e33243500d5c"; // DJ Puddles

key    Key_query;
string AccessList;
key    curr_key;
list   allAccess;

default
{
    state_entry()
    {  // llLinksetDataReset( );
          
        allAccess += key_a;
        allAccess += key_b;
        allAccess += key_c;
        allAccess += key_d;
        
       AccessList = llList2Json( JSON_OBJECT, [] ); 
       // ------------------------
       integer len = llGetListLength(allAccess);
       integer n;
       for( ; n < len; ++n )
       {  
          llSleep(0.2);          
          curr_key = llList2Key( allAccess, n);
             llOwnerSay("curr key: " + (string)n + ". " + (string)curr_key );
          
          if (llJsonGetValue (AccessList, [curr_key] ) == JSON_INVALID) 
          {   AccessList  = llJsonSetValue (AccessList, [curr_key,  "name"], "");  
              AccessList  = llJsonSetValue (AccessList, [curr_key,  "id"], curr_key);             
              Key_query   = llRequestAgentData(curr_key, DATA_NAME); 
              llSleep(0.2);     
          }
       }
       list blocks = llLinksetDataFindKeys("^Access: ", 0, 0);
       string tmp = llDumpList2String( blocks, "\n");
       llOwnerSay("Debug: \n" + tmp);
    }
    touch_start(integer total_number)
    {  list blocks = llLinksetDataFindKeys("^Access: ", 0, 0);
       string tmp = llDumpList2String( blocks, "\n");
       llOwnerSay("Debug: \n" + tmp);    
    }
    dataserver(key queryid, string data) // how to get id added HERE
    {
        if ( queryid == Key_query)
        {  
             AccessList      = llJsonSetValue (AccessList, [curr_key,  "name"], data);  
             string currName = data;                 
             key curr_id     = llJsonGetValue (AccessList, [curr_key, "id"]);              
               llOwnerSay("Name retrieved: " + currName );               
             llLinksetDataWrite("Access: " + currName, curr_id);
        }
    }
}

 

Edited by Xiija
Posted

I'm not sure what problem you're having as I'm having a bit of trouble understanding exactly what you're trying to do, but the main thing that pops out to me is that you're overwriting Key_query for each user in a loop, and losing all but the last one to check against the dataserver event.

You are about to reply to a thread that has been inactive for 98 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
×
×
  • Create New...