From: Rafaella Schumann
http://www.lslwiki.net/lslwiki/wakka.php?wakka=dataserverIt's really hard to me to understand.Can someone help me ?
this example almost do what I need...I need to detect agents and tell the date of SL account and payment info parameters at the same time.
but I really can't work with this code...
the final relsult should be "was born at (day) and the return of payinof is (something)
can someone tell me with mod I should perform in this example of wiki ?
ty !
You could try something like this (untested, just a concept):
list avatars;
list requests_born;
list requests_pay;
key avatar;
integer av_num = 0;
integer processed_pay = 0;
integer processed_born = 0;
default
{
state_entry()
{
llSensor("", NULL_KEY, AGENT, 96.0, PI);
}
sensor(integer num_detected)
{
integer i;
avatars = [];
requests = [];
for(i=0; i<num_detected; ++i)
{
avatar = llDetectedKey( i );
avatars += [avatar];
av_num++;
requests_born += (string)llRequestAgentData(avatar, DATA_BORN);
requests_pay += (string)llRequestAgentData(avatar, DATA_PAYINFO);
}
}
dataserver(key queryid, string data)
{
integer idx;
idx = llListFindList(requests_born, [(string)queryid]);
//av
avatar = llList2Key(avatars, idx); // as we added the requests in the same order as avatars
if(idx != -1) //born info
{
llListReplaceList(requests_born, [data], idx, idx);
processed_born++;
}
else
{
idx = llListFindList(requests_pay, [(string)queryid]);
if(idx != -1) //pay info
{
llListReplaceList(requests_pay, [data], idx, idx);
processed_pay++;
}
}
if( (processed_born == av_num) && (processed_pay == av_num) )
{
for(idx=0;idx<av_num;i++)
{
llSay(0,llList2String(avatars,idx) +
"was born on " +
llList2String(requests_born,idx) +
"and has pay status:" +
llList2String(requests_pay,idx));
}
}
}
}