|
Lennard Lopez
Registered User
Join date: 9 Oct 2007
Posts: 52
|
02-03-2009 05:12
Hello, I want to reset a script after the sim is resetted. So I wrote some code. Because testing is not so easy I want to ask others if this would work. Or is there a better way to detect a sim reset? float Time; float TTime; float step=60; default { state_entry() { Time=(float)llGetUnixTime(); llSetTimerEvent(step);} timer(){ TTime=Time+(1.05*step); //May be some lag??? Time=llGetUnixTime(); if (TTime<Time) llResetScript();} }
|
|
Nexii Malthus
[Cubitar]Mothership
Join date: 24 Apr 2006
Posts: 400
|
02-03-2009 05:32
There will be soon a new variable for the changed event for detecting sim resets, it is already out on the beta grid.
_____________________
 Geometric Library, for all your 3D maths needs. https://wiki.secondlife.com/wiki/Geometric Creator of the Vertical Life Client
|
|
Lennard Lopez
Registered User
Join date: 9 Oct 2007
Posts: 52
|
02-03-2009 08:04
A new changed? Great! But for the time beeïng? Does this little script reset in case of a sim reset?
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
02-03-2009 13:28
It's fairly easy to get more lag than that. I'd make it more like a 3 minute difference that triggers the reset. There are some other things you might check to eliminate false positives, such as making sure llGetTimeOfDay() is small (say, less than 60) and maybe making sure there aren't a large number of avatars in the sim. Another possibility is to try 'llRequestSimulatorData(llGetRegionName(), DATA_SIM_STATUS)'. If the resulting dataserver event tells you the sim is "starting", that'd be a good time to reset. Of course, I'm not sure if scripts ever get that status while they are in the region being tested, or if you only get it from outside and scripts inside don't start running until the sim has the "up" status. Maybe someone who manages a private estate somewhere can reset it sometime and try this out. Or post the info if it's already been tested, of course. http://www.lslwiki.net/lslwiki/wakka.php?wakka=llRequestSimulatorDatahttp://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetTimeOfDayhttp://wiki.secondlife.com/wiki/LlGetRegionAgentCount
|