/////////////////////////////////////////////////////////////////////////// // Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3 // // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // // rights of fair usage, the disclaimer and warranty conditions. // /////////////////////////////////////////////////////////////////////////// key nQuery = NULL_KEY; integer nLine = 0; list nList = []; list oList = []; integer cursor = 0; default { state_entry() { integer i = llGetInventoryNumber(INVENTORY_NOTECARD)-1; do { if(llGetInventoryName(INVENTORY_NOTECARD, i) == "agents") jump found_notecard; } while(--i>-1); llSay(DEBUG_CHANNEL, "Could not find agents notecard."); return; @found_notecard; nQuery = llGetNotecardLine("agents", nLine); } changed(integer change) { if(change & CHANGED_INVENTORY) llResetScript(); } dataserver(key id, string data) { if(id != nQuery) return; if(data == EOF) state scan; if(data == "") jump next_line; nList += data; oList += 0; @next_line; nQuery = llGetNotecardLine("agents", ++nLine); } } state scan { state_entry() { llRequestAgentData(llList2Key(llParseString2List(llList2String(nList, cursor), ["#"], []), 1), DATA_ONLINE); } dataserver(key id, string data) { string name = llList2String(llParseString2List(llList2String(nList, cursor), ["#"], []), 0); integer online = llList2Integer(oList, cursor); if(data == "0" && online == 1) { llInstantMessage(llGetOwner(), name + " is offline."); oList = llListReplaceList(oList, (list)0, cursor, cursor); jump next; } if(data == "1" && online == 0) { llInstantMessage(llGetOwner(), name + " is online."); oList = llListReplaceList(oList, (list)1, cursor, cursor); jump next; } @next; if(++cursor > llGetListLength(nList)-1) cursor = 0; llRequestAgentData(llList2Key(llParseString2List(llList2String(nList, cursor), ["#"], []), 1), DATA_ONLINE); } changed(integer change) { if(change & CHANGED_INVENTORY) llResetScript(); } }