User:Trinity Coulter/Online indicator
Jump to navigation
Jump to search
Someone was asking for an online indicator that would check the description field of a prim for an avatar key and tell you their online status. I made this so that it would get the owner's key by default when you set out the prim, but its free to change how you like :)
<lsl> key query_id; key current_avie_key; integer action = DATA_NAME; string avie_name; string online_status = "offline";
default {
state_entry() { llSetObjectDesc((string)llGetOwner()); llSetTimerEvent(5.0); } on_rez(integer start_param) { llResetScript(); } timer() { if (current_avie_key == (key)llGetObjectDesc()) { action = DATA_ONLINE; query_id = llRequestAgentData(current_avie_key, action); } else { action = DATA_NAME; current_avie_key = (key)llGetObjectDesc(); query_id = llRequestAgentData(current_avie_key, action); online_status = "offline"; } }
touch_start(integer total_number) { llSay(0, "Touched."); } dataserver(key queryid, string data) { if(action == DATA_NAME) { avie_name = data; } if(action == DATA_ONLINE) { if(data == "1") { online_status = "online"; } else { online_status = "offline"; } } if(online_status == "online") { llSetColor(<0,1,0>,ALL_SIDES); } else { llSetColor(<1,0,0>,ALL_SIDES); } llSetText(avie_name + " is " + online_status,<1,1,1>,1.0); }
} </lsl>