Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Online Indicator help

Ikonn Giano
Registered User
Join date: 15 Dec 2007
Posts: 126
01-22-2009 11:07
I am looking for a way to pull the name/key from the description field and not use the owner is this possible and how could I do that? I would also like to use a texture and not color changing prim .


Example of the description field “Firstname Lastname^22^2009-01-22^18051^UUID KEY of avitar^0”

Thank you in advance for any help
Ilayda Reina
Registered User
Join date: 21 Nov 2007
Posts: 31
01-22-2009 11:35
This is Kristy Fanshaw's script tweaked a bit by me :
it gets the key from Object Description

From: someone



key user_key = "00000000-0000-0000-0000-000000000000";
integer time = 30;
string url = "http://world.secondlife.com/resident/";
key blank = "5748decc-f629-461c-9a36-a35a221fe21f";
string name;
key toucher;
string status;

default
{
state_entry()
{
user_key = llGetObjectDesc();
llSetText("", <1,0,0>, 1.0);
llSetTexture(blank, ALL_SIDES);
llRequestAgentData( user_key, DATA_NAME);
}
dataserver(key queryid, string data)
{
name = data;
llSetObjectName(name + "'s Online Detector";);
state show;
}
}
state show
{
state_entry()
{
llSetTimerEvent(10);
}
timer()
{
llHTTPRequest( url + (string)user_key,[HTTP_METHOD,"GET"],"";);
llRequestAgentData( user_key, DATA_ONLINE);
}
on_rez(integer start_param)
{
llSetText("", <1,0,0>, 1.0);
llSetTexture(blank, ALL_SIDES);
}
http_response(key request_id,integer status, list metadata, string body)
{
if (llSubStringIndex(body, "parcelimg";) == 1)
{
if (llSubStringIndex(body, "blank.jpg";) == -1)
{
integer start_UUID = llSubStringIndex(body,"<img alt=\"profile image\" src=\"http://secondlife.com/app/image/";) + llStringLength("<img alt=\"profile image\" src=\"http://secondlife.com/app/image/";);
integer end_UUID = llSubStringIndex(body,"\" class=\"parcelimg\" />";) - 3;
string profile_pic = llGetSubString(body, start_UUID, end_UUID);
llSetTexture((key)profile_pic, ALL_SIDES);
}
}
else
{
llSetTexture(blank, ALL_SIDES);
}
}
dataserver(key queryid, string data)
{
if ( data == "1" )
{
status = " is online";

llSetText(name + status, <0,1,0>, 1.0);
}
else if (data == "0";)
{
status = " is offline";

llSetText(name + status, <1,0,0>, 1.0);
}

}
touch_start(integer num_detected)
{
toucher = llDetectedKey(0);
state msg;
}
}
state msg
{
state_entry()
{
llListen(0,"",toucher,"";);
llInstantMessage(toucher, "write your message to " + name +" - you have " +(string)time + " seconds";);
llInstantMessage(toucher, "to see " + name +"'s profile, click this link here: secondlife:///app/agent/" + (string)user_key + "/about";);
llSetTimerEvent(time);
}
listen(integer ch, string name, key id, string msg)
{
llInstantMessage(user_key, llKey2Name(toucher) + " sent you a message from " + llGetRegionName() + ": " + msg);
llInstantMessage(toucher, "message is sent.";);
llListenRemove(0);
state show;
}
timer()
{
llInstantMessage(toucher, "time is up - touch again to write a message";);
llListenRemove(0);
state show;
}
}