key online_query;There are a few things you'll notice right away. First of all I have this set up so it gets the info of whoever touched the prim. The next thing is that I have four queries set up for each of the pieces of data we want to get, and finally inside the dataserver event we have four "if" statements that handle each of the queries. The name query returns the avatar's name as a string, their online status returns as an integer disguised as a string (either 1 or 0 depending on their online status), their birthday returns as a string in the format YYYY-MM-DD, and their payment info also returns as integers in string format, 0 for no payment info, 1 for pay info on file, and 3 for pay info used. Don't ask what happened to 2.
string name_query;
string birthday_query;
string payinfo_query;
string owner_name;
string online;
string birthday;
string payinfo;
default
{
touch_start(integer total_number)
{
key id = llDetectedKey(0);
name_query = llRequestAgentData(id, DATA_NAME);
online_query = llRequestAgentData(id, DATA_ONLINE);
birthday_query = llRequestAgentData(id, DATA_BORN);
payinfo_query = llRequestAgentData(id, DATA_PAYINFO);
}
dataserver(key queryid, string data)
{
//Find out their name --------------------------------------
if ( name_query == queryid )
{
owner_name = data;
llSay(0, "The name of the person is : " + owner_name );
}
//Find out if they are online-------------------------------
if ( online_query == queryid )
{
online = data;
if (online == "1"){
llSay(0, "he or she is online");
}
else
{
llSay(0, "he or she is offline");
}
}
//Find when their birthday is -------------------------------
if ( birthday_query == queryid )
{
birthday = data;
llSay(0, "Their birthday is "+ birthday);
}
//Find out what their payment info status is ----------------
if ( payinfo_query == queryid )
{
payinfo = data;
if (payinfo == "0"){
llSay(0, "They have no payment info on file");
}
if (payinfo == "1"){
llSay(0, "They have payment info on file");
}
if (payinfo == "3"){
llSay(0, "Their payment info has been used");
}//end if(payinfo == "3")
}//end query if
}//end dataserver
}//end default
So now you know how to get most of the data on someone's avi. If you want to do other things with this info you can put your functions in the dataserver event, inside the if statement pertaining to that piece of information.
0 comments:
Post a Comment