//llRequestAgentData DataServer Example
//by Hank Ramos
key nameRequestID;
key bornRequestID;
key ratingRequestID;
 
default
{
    state_entry()
    {
        llSay(0, "Ready. Click to start.");
    }
    touch_start(integer num_detected)
    {
        integer x;
 
        //Loop through the number of Agents touching this prim
        for (x=0;x < num_detected; x += 1)
        {
            //Request the name of the Agent
            //Note: llKey2Name could be used, but it only works if the avatar
            //is currently located in the simulator
            nameRequestID   = llRequestAgentData(llDetectedKey(x), DATA_NAME);
 
            //Request the born date of the Agent
            bornRequestID   = llRequestAgentData(llDetectedKey(x), DATA_BORN);
 
            //Request the ratings of the Agent
            ratingRequestID = llRequestAgentData(llDetectedKey(x), DATA_RATING);
        }
    }
    dataserver(key queryid, string data)
    {
        list tempList;
        //Check to make sure this is the request we are making.
        //Remember that when data comes back from the dataserver,
        //it goes to *all* scripts in your prim.
        //So you have to make sure this is the data you want, and
        //not data coming from some other script.
 
        //Check to see if the query is for the Agent Name
        if (queryid == nameRequestID)
        {
            llSay(0, "Your Name is: " + data);
        }
        //Check to see if the query is for the Agent Born Date
        if (queryid == bornRequestID)
        {
            llSay(0, "Your Were Born: " + data);
        }
        //Check to see if the query is for the Agent Ratings
        if (queryid == ratingRequestID)
        {
            tempList = llCSV2List(data);
            llSay(0, "Your Behavior   Rating: +" + llList2String(tempList, 0) + " -" + llList2String(tempList, 1));
            llSay(0, "Your Appearance Rating: +" + llList2String(tempList, 2) + " -" + llList2String(tempList, 3));
            llSay(0, "Your Building   Rating: +" + llList2String(tempList, 4) + " -" + llList2String(tempList, 5));
        }
    }
}