Jump to content

Reading notecard of av keys, converting to av names


GloriaGlitter
 Share

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

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

Recommended Posts

Hi there - I was given a dump of our group members keys.  For my project, I need a notecard of legacy names rather than keys.  So I thought I'd write a quick script to read the notecard and output the legacy names which I'd cut and paste from the chat window to a notecard.  My script correctly reads the notecard which I can see by the first llOwnerSay but the  llRequestAgentData doesn't give the corresponding legacy name but some other key.  I imagine I have made an error in the dataserver part of the script.

Using notecard called 'keylist' with 3 keys to test:

8cdf1317-e9c2-41f6-a0e3-793f69fc76dc
5b6e2121-5847-4b84-a260-3dd37f4d0d65
2d55c505-9530-40a9-a153-ce3878b0314b

this is my script:

string NOTECARD = "keylist";    //Name of notecard containing group member keys
key namekey;
string resident;
integer intLine1 = 0;

default
{
    state_entry()
    {
        namekey = llGetNotecardLine(NOTECARD, 0);
    }

   dataserver(key keyQueryId, string Data)
    {
        if (keyQueryId == namekey)
        {
        if (Data != EOF)   
 
            namekey = llGetNotecardLine(NOTECARD, ++intLine1);
          
           llOwnerSay("namekey = " + (string)Data);   //test to check notecard read ok
           resident = llRequestAgentData(Data, DATA_NAME);
           llOwnerSay ("Resident = " + resident);
         }
      }
 
   touch_start(integer x)
   {
     llResetScript();
   }
}

 

Link to comment
Share on other sites

that's because llRequestAgentData triggers another data event like reading the notecard, and the key you're seeing is the data event key

 

this should work....

string NOTECARD = "keylist";    //Name of notecard containing group member keys
key namekey;
key resident;
integer intLine1 = 0;

default
{
    state_entry()
    {
        namekey = llGetNotecardLine(NOTECARD, 0);
    }

   dataserver(key keyQueryId, string Data)
    {
        if(keyQueryId == namekey)
        {
        	if(Data != EOF)
			{
                llOwnerSay("namekey = " + (string)Data);   //test to check notecard read ok
           		resident = llRequestAgentData(Data, DATA_NAME);
			}
			else
			{
				llOwnerSay("End of notecard");
			}
         }
		else if (keyQueryId == resident)
		{
			llOwnerSay ("Resident = " + resident);
			namekey = llGetNotecardLine(NOTECARD, ++intLine1);
		}
      }
 
   touch_start(integer x)
   {
     llResetScript();
   }
}

 

Edited by Ruthven Ravenhurst
  • Thanks 1
Link to comment
Share on other sites

Thanks Ruthven for quick response.   This still gives me a data event key instead of the legacy name - this was the output in the chat window I got just now with the amended code:

  namekey = 8cdf1317-e9c2-41f6-a0e3-793f69fc76dc
  Resident = 1091b48e-18c3-86f5-a92a-79dad7035e21
  namekey = 5b6e2121-5847-4b84-a260-3dd37f4d0d65
  Resident = 1c4dcdc1-bd7c-e70d-318d-3c63d5829477
  namekey = 2d55c505-9530-40a9-a153-ce3878b0314b
  Resident = cc86f9c6-8227-9fd5-65f7-cb9fb434e7b6
  End of notecard

Any ideas?

Link to comment
Share on other sites

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