Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Library: Online checker.

Silje Russell
lsl geek
Join date: 2 Oct 2005
Posts: 63
08-10-2007 08:54
Scripted way to check if a name is online widout know the key

CODE

string NAME = "Masakazu Kojima";
string URL = "http://w-hat.com/name2key";
key reqid;

integer uuid = FALSE;
key oncheck;

integer chan = 99;

default
{
state_entry()
{
llListen(chan,"",llGetOwner(),"");
}

on_rez(integer rez)
{
llOwnerSay("I listen on channel "+(string)chan+" and you can use commands like 'uuid <name>' or 'online <name>' as functions");
}
listen(integer number, string name, key id, string message)
{
list temp = llParseString2List(message,[" "],[]);
string com = llToLower(llList2String(temp,0));
string who = llList2String(temp,1)+" "+llList2String(temp,2);
if(llGetListLength(temp) != 3)
{
llOwnerSay("cant check that");
return;
}
if(com == "online")
{
NAME = who;
reqid = llHTTPRequest( URL + "?terse=1&name="+llEscapeURL(NAME), [], "" );
uuid = FALSE;
}
else if(com == "uuid")
{
NAME = who;
reqid = llHTTPRequest( URL + "?terse=1&name="+llEscapeURL(NAME), [], "" );
uuid = TRUE;
}
}

http_response(key id, integer status, list meta, string body)
{
if ( id != reqid )
{
return;
}
if ( status == 499 )
{
llOwnerSay("name2key request timed out");
}
else if ( status != 200 )
{
llOwnerSay("the internet exploded!!");
}
else if ( (key)body == NULL_KEY )
{
llOwnerSay("No key found for " + NAME);
}
else
{
if(!uuid)
{
oncheck = llRequestAgentData(body, DATA_ONLINE);
return;
}
llOwnerSay(NAME + "'s key is: " + body );
}
}

dataserver(key id,string data)
{
if(id == oncheck)
{
string status = "offline";
if(data == "1")
{
status = "online";
}
llOwnerSay(NAME + " is: " + status );
}
}
}
_____________________
Yes i know i got typos..
I got writing and reading problems.
but i am still a humen!!
Isebella Dallagio
Registered User
Join date: 15 Aug 2007
Posts: 5
04-09-2008 00:58
so that's how my stalker knows I'm online??? damnit!!!
Boreal Latte
Registered User
Join date: 15 Nov 2007
Posts: 104
04-09-2008 03:00
From: Isebella Dallagio
so that's how my stalker knows I'm online??? damnit!!!

Just extend it with a timer, and a http poster, and you can make your personal "Stalkers online" service - it is going to be a blast :-)
Silje Russell
lsl geek
Join date: 2 Oct 2005
Posts: 63
04-09-2008 06:46
This is not ment to stalk anybody this is a tool i made when friend list was down
_____________________
Yes i know i got typos..
I got writing and reading problems.
but i am still a humen!!
Imnotgoing Sideways
Can't outlaw cute! =^-^=
Join date: 17 Nov 2007
Posts: 4,694
04-09-2008 08:05
Ooh... One more way to keep up. (^_^)

/me adds a notecard reader, a timer, and a list of my usual victims... (^_^)y
_____________________
Somewhere in this world; there is someone having some good clean fun doing the one thing you hate the most. (^_^)y


http://slurl.com/secondlife/Ferguson/54/237/94
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
online status and key return
04-09-2008 21:18
I just wrote something similar, type xonline Avatar Name to get the online status, and xkey Avatar Name to get that avatar's key (useful for vendor split programs, etc).

CODE

string NAME;
string URL = "http://w-hat.com/name2key";
key reqid;
integer keyQuery = FALSE;
integer onlineStatus = FALSE;
key onlineQueryID;

default
{
state_entry()
{
integer handle = llListen (0,"",llGetOwner(),"");
}

listen (integer channel, string name, key id, string message)
{
integer index = llSubStringIndex (message, "xkey ");
if (index == 0)
{
string temp = llGetSubString (message, 5, -1);
NAME = temp;
keyQuery = TRUE;
reqid = llHTTPRequest( URL + "?terse=1&name=" + llEscapeURL(NAME), [], "" );
}
index = llSubStringIndex (message, "xonline ");
if (index == 0)
{
string temp = llGetSubString (message, 8, -1);
NAME = temp;
onlineStatus = TRUE;
reqid = llHTTPRequest( URL + "?terse=1&name=" + llEscapeURL(NAME), [], "" );
}
}

http_response(key id, integer status, list meta, string body)
{
if ( id != reqid )
return;
if ( status == 499 )
llOwnerSay("ERROR:Name2Key request timed out");
else if ( status != 200 )
llOwnerSay("Status 200 returned");
else if ( (key)body == NULL_KEY )
llOwnerSay("No key found for " + NAME);
else if (keyQuery)
{
llOwnerSay(NAME + "'s key is: " + body );
keyQuery = FALSE;
}
else if (onlineStatus)
{
onlineStatus = FALSE;
onlineQueryID = llRequestAgentData (body, DATA_ONLINE);
}
}

dataserver (key query, string data)
{
if (query = onlineQueryID)
{
integer status = (integer)data;
if (status)
{
llOwnerSay (NAME + " is ONLINE");
}
if (!status)
{
llOwnerSay (NAME + " is OFFLINE");
}
}
}
}