Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Q: Avatar last logon?

Sam Brewster
Registered User
Join date: 20 Feb 2006
Posts: 82
07-04-2006 15:38
Is there a way to tell when an avatar last logged on?

If you look at group members in a group, it will show you the last date they logged on. Is there a way to script last logon date? I've looked through the Wiki, but didn't see any appropriate functions.


Sam
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
07-04-2006 15:41
Nothing direct. Only alternative really is to do it yourself by polling the avatar, ie check if the avatar is online using llRequestAgentData (iirc, may be info or such). This lets you check online status, if they are online, update the last-online time, if not then ignore it.
Just don't do it too frequently, you can usually assume an avatar will log-in for around a minute at least, even if they crash or something.
_____________________
Computer (Mac Pro):
2 x Quad Core 3.2ghz Xeon
10gb DDR2 800mhz FB-DIMMS
4 x 750gb, 32mb cache hard-drives (RAID-0/striped)
NVidia GeForce 8800GT (512mb)
Frosty Fox
Registered User
Join date: 28 Feb 2005
Posts: 18
07-05-2006 02:35
Orignally made to see if a old friend was still loggin on .
just add the avtars Key where "user_key=NULL_KEY"


CODE

// Made By Frosty Fox
// 05/05/06 (Optimised)
//// SETTINGS /////////

key user_key=NULL_KEY; // persons key you are checking
string user_name="Frosty"; // persons name you are checking
integer time_length = 120; // timmer length in seconds

//// END OF SETTINGS //
//
///////////////////////

list people;
list lasttimes;
integer on;
key q_id;
key last_id;
integer online = FALSE;




string time()
{
// Frostys Time Function (AM/PM CLOCK)

integer t_12;
integer t= (integer)llGetWallclock();
integer hours = t / 3600;

if(hours >=12) // if the clock hour is m more than 12
{
t_12=TRUE;
hours -=12;
}
integer minutes = (t % 3600) / 60;
string min;

if(llStringLength((string)minutes)==1)
{
min = "0"+(string)minutes;
}
else
{
min = (string)minutes;
}

if(t_12==TRUE)
{
min+= "PM";
}
else
{
min+= "AM";
}

return (string)hours+":"+(string)min;
}

check_online(key id)
{
on=TRUE;
last_id = llRequestAgentData(id,DATA_ONLINE);
}


text()
{
llSetText(user_name+" Report\n"+llDumpList2String(lasttimes, "\n"),<0,1,0>,1.0);
}

default
{
state_entry()
{
llOwnerSay("Online Checker Ready");
llSetTimerEvent(time_length);
if(user_key==NULL_KEY)
{
user_key = llGetOwner();
}
check_online(user_key);

}
on_rez(integer n)
{
llOwnerSay("Please wait resetting");
llResetScript();
}
timer()
{
llSetText("",<0,0,0>,1.0);
check_online(user_key);
}


touch_start(integer num_detected)
{
if(llDetectedKey(0)==llGetOwner()) // only the owner can retreve the info
{
text();
llOwnerSay(llDumpList2String(lasttimes, "/"));
}

}
dataserver(key queryid, string data)
{
if(queryid == last_id)
{

if((integer)data==TRUE) // if user online
{
if(!online) // if user is not logged but online
{
online=TRUE;
lasttimes+=[user_name+" Online at "+(string)llGetDate()+" "+(string)time()];
// log them
}
}
else // if there not online
{
if(online) // if thay was online last time
{
// llOwnerSay("thay have logged out and it has been recorded ");
online=FALSE;
lasttimes+=[user_name+" Logged out at "+(string)llGetDate()+" "+(string)time()];
}
}
}
}
}

any feadback on this would be nice :)