Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Need HUD to react as owner logs off?

Liam Tairov
Registered User
Join date: 20 Nov 2007
Posts: 58
12-14-2009 23:41
Does anyone know how to get a HUD to react when the owner logs off.

I've tried using the Attach event to send an HTTP request to my web server but the request is never sent. Also tried sending an email within the Attach event. It seems that the script just hibernates at owner log off.

The same Attach event method works when the owner logs on so the comms is okay.

Any ideas whether this is possible or not?

Hopefully i have missed the obvious.
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
12-14-2009 23:47
a script can't run when it's not in world, which is basically what happens to the hud when the owner logs off. you would need to poll the sl server from your server to see if the avatar is online or not. either that or you would need an object that remains in world for check the avatar's status
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Liam Tairov
Registered User
Join date: 20 Nov 2007
Posts: 58
12-15-2009 01:50
From: Ruthven Willenov
a script can't run when it's not in world, which is basically what happens to the hud when the owner logs off. you would need to poll the sl server from your server to see if the avatar is online or not. either that or you would need an object that remains in world for check the avatar's status


Thank you for confirming the situation when a person logs off and your workaround suggestions.

I was slowly coming to this conclusion but unfortunately neither workarounds are feasible due to the number of HUDs connecting to the server and database. Perhaps I'll have to imply a timeout when one HUD tries to talk to another in case the target is offline.
Liam Tairov
Registered User
Join date: 20 Nov 2007
Posts: 58
12-15-2009 11:46
Just an update, I'm now using llRequestAgentData to see if the target owner is online/offline. Clearly not as good as if the target HUD reported when its owner logged off but it works.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-15-2009 13:08
you can have the hud send a message to an inworld object, which adds the name if not found, and then removes it if it doesn't receive a message after awhile...

if it's only needed for a single sim, you could do this via a region say on a cycle.

the receiving prim gets the message and saves the name and a timestamp, and periodically checks to see that timestamps in it's list are not older than 2 cycles. if they are it removes the associated name.

example:
CODE

//-- in the hud code
default{
state_entry(){
llSetTimerEvent( 300.0 ); // five minute timer
}

timer(){
llRegionSay( -42, "Checking In" );
}
}


//-- in the receiver prim
list gLstActive; //-- Global list
list gLstTimes; //-- Global List

default{
state_entry(){
llListen( -42,"","","Checking In" );
llSetTimerEvent( 600.0 );
}

listen( integer vIntChn, string vStrNom, key vKeyAv, string vStrMsg ){
integer vIdxLst = llListFindList( gLstActive, (list)vKeyAv );
if (~vIdxLst){ // remove stale listings
llDeleteSubList( gLstActive, vIdxLst );
llDeleteSubList( gLstTimes, vIdxLst );
}
// Place Fresh listings
gLstActive += (list)vKeyAv;
gLstTimes += (list)llGetUnixTime();
}

timer(){
integer vIntCnt;
integer vIntTim = llGetUnixTime() - 300;
while (vIntTim > llList2Integer( gLstTimes, vIntCnt )){
++vIntCnt;
}
if (vIntCnt){
gLstActive = llList2List( gLstActive, vIntCnt, -1 );
gLstTimes = llList2List( gLstTimes, vIntCnt, -1 );
}
//-- do whatever you want with the active names here.
}
}
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Liam Tairov
Registered User
Join date: 20 Nov 2007
Posts: 58
12-16-2009 02:35
From: Void Singer
you can have the hud send a message to an inworld object, which adds the name if not found, and then removes it if it doesn't receive a message after awhile...

if it's only needed for a single sim, you could do this via a region say on a cycle.

the receiving prim gets the message and saves the name and a timestamp, and periodically checks to see that timestamps in it's list are not older than 2 cycles. if they are it removes the associated name.


Hi Void, thank you for an interesting code solution.

Unfortunately the users and huds won't always be on their own land as the huds must be usable anywhere in SL.

Your code solution could also be extended to an in-world object send pinger emails to the huds but the expected number of huds makes this unfeasible to.

Its a pity a hud couldn't execute a few cycles event triggered by the avatar logging off as it would save a lot of effort here.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-16-2009 09:02
unfortunately that's about as close as we can get..... reversing the process you could have the hud send a wake up message to a particular server prim and then have that hand it off to sub scripts which do their own constant polling of the avatar in question.... but that'd rack up a LOT of use on a region really fast.

a similar trick might work for a web server, or a bot, but polling is about all we've got in this case.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -