This script uses link_message to receive a list of UUID keys from another script and converts it to a list. It then uses the message number to identify that it is the correct message and validates the data format/length. If the data passes that validation, it performs llRequestAgentData to get the online status of the agent.
The problem seems to be that although llRequestAgentData is being performed multiple times, the dataserver event handler is only returning one result.
Sample code follows. Any ideas are (very) welcome.
// Global Variables
key onlineStatusRequest;
string incomingText;
string incomingKeyID;
string avatarStatus;
string avatarStatuses = "";
integer avatarNumber = 1;
integer incomingNumber = 0;
integer incomingListLength = 0;
list incomingList;
default
{
on_rez(integer startParam)
{
}
//When this script receives a message
link_message(integer Sender, integer Number, string Text, key ID)
{
incomingText = Text;
incomingNumber = Number;
incomingKeyID = ID;
incomingList = llParseString2List(incomingText,["|"],[]);
incomingListLength = llGetListLength(llParseString2List(incomingText,["|"],[]));
// if string of avatar keys is received which is the proper length (eliminates partial lists)
if (incomingNumber == 40 && incomingKeyID == (string)incomingListLength )
{
integer x;
integer length = llGetListLength(incomingList);
for(x = 0; x < length; x++)
{
onlineStatusRequest = llRequestAgentData(llList2String(incomingList, x), DATA_ONLINE);
llOwnerSay("sent request for " + llList2String(incomingList, x) + " status"
; // debug aid - confirms that a request was sent}
}
}
dataserver(key queryid, string data)
{
if (queryid == onlineStatusRequest) // check to be sure this is the correct llRequestAgentData query
{
llOwnerSay("Online status returned a value of " + data); //debug aid - result of online status request
if (data == "1"
// online status is just 0 or 1avatarStatuses = (avatarStatuses = ""
+ avatarStatuses + "Online" + "|"; else
avatarStatuses = (avatarStatuses = ""
+ avatarStatuses + "Offline" + "|"; }
}
}
