Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Function triggered depending on time

AlanTVF Proto
Registered User
Join date: 19 Oct 2007
Posts: 1
01-30-2008 08:45
Hi,

Apologises for newbie question - I want to trigger a function at a certain time say at midnight GMT time. I know I can use llGetTimestamp() to get the time but how do I trigger a function without an event happening?

Thanks
Very Keynes
LSL is a Virus
Join date: 6 May 2006
Posts: 484
01-30-2008 11:27
Ues a timer event and then compare the time inside the event.
This should do it (but i have not tested it)

If you needed to rase an event in a sript only at midnight use this

default
{
state_entry()
{
llSetTimerEvent(60.0);
}
timer()
{
list timestamp = llParseString2List( llGetTimestamp(), ["T",":","Z"] , [] );
if(0==llList2Integer(timestamp,1))llMessageLinked(LINK_THIS,0,"it is midnight","";);
}
}

Then in the script to be interupted use a linkmessage event.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
01-30-2008 16:00
llGetGMTclock() might be better for you too

also as a concept, instead of having a lot of timer comparisons, have only one

CODE

default{
state_entry(){
llSetTimerEvent( 86400 - llGetGMTclock() );
}

timer(){
//-- do stuff
llSetTimerEvent( 86400 - llGetGMTclock() );
}
}


just be aware that timers are subject to sim time dialation, so it'll always be a little off, but the second call from within the timer should keep it from being increasingly unstable
_____________________
|
| . "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...
| -