Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Timer() problem using llRequestAgentData

Bones Outlander
Registered User
Join date: 16 Jan 2008
Posts: 30
08-04-2009 08:26
I've run into a problem that's driving me MAD!!! And I hope somebody here might be able to shed some light/ideas on where I can look.

I have a script that polls the online status of avatars, it works fine for a while (several hours) and then just suddenly stops. I've narrowed it down to the fact that the timer() is not being reset at the end of a poll for some reason and is being left disabled.

Here is the section of the script where the timer is triggered, the polling done and then in theory the timer reset. NOTE: I have removed most of the code (string processing etc) for clarity.

iPollInterval is set to 30

It's probably something silly, but what am I doing wrong or what should I be doing to stop this??? Could the llRequestAgentData be timing out not responding and leaving my script in limbo, or is it soemthing else??

Many thanks
Bones

CODE

if(kId == kTimeroncheck)
{
if(sData == "1")
{
iStatusChange = TRUE;
sWebOnline = (sWebOnline="") + sWebOnline + "," + llList2String(lAvi_name, x);
}
else
{
iStatusChange = FALSE;
}

if (x < llGetListLength(lAvi_keyid) - 1){
x++;
kTimeroncheck = llRequestAgentData(llList2String(lAvi_keyid, x), DATA_ONLINE);
}
else
{
// Now use Link Message to send updated list to comms script
if (sWebOnline=="") sWebOnline = ",Nobody Online";
llMessageLinked(LINK_THIS, 10,sWebOnline, NULL_KEY);
llSetTimerEvent(iPollInterval);

}

}
}


timer()
{
if (DEBUGMODE == TRUE) llOwnerSay("Main: Timer Triggered");
llSetTimerEvent(0.0); // Disable Timer during polling
x=0; //reset counter
sWebOnline = "";
kTimeroncheck= llRequestAgentData(llList2String(lAvi_keyid, x), DATA_ONLINE);
}

Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
08-04-2009 08:56
There is only a partial script there, but where are you turning the timer back on, inside the dataserver event? It's really not a good idea to assume dataserver will happen every time, this is SL after all! Instead of 0, maybe set the timer to some longer interval so that it can try again if the query fails.
Tali Rosca
Plywood Whisperer
Join date: 6 Feb 2007
Posts: 767
08-04-2009 10:13
I gather you turn the timer back on once you get the answer from the dataserver.
While I've never actually seen it happen, I see no reason why it shouldn't potentially fail and never answer; even just the sim restarting as the answer comes in would break the chain.

But why are you turning the timer off in the first place?
Bones Outlander
Registered User
Join date: 16 Jan 2008
Posts: 30
08-04-2009 14:21
The reason I set the timer to 0 ws to ensure it didn't trigger while a poll was in progress, but I obviously made the incorrect assumption that the dataserver request would always get a reply (DUH!).

After I posted my original post I though I should just change the timer(0) to a large number like 60 to act as a timeout should the dataserver response not come back.... obvious really I guess, but sometimes one needs to ask a question so one can answer it themselves :)



Thanks for the responses.

Bones