Page 1 of 1

Bug: Timers don't survive logouts/server restarts

Posted: Sun Nov 06, 2005 11:40 pm
by Grimson
It seems like some (or all timers) don't survive a logout or server restart.

For example the timer to decrease the murder count, if you kill innocent NPCs, then logout and login again your murder count won't decrease over time unless you kill another innocent.

It also happens with spells, for example call "Incognito" which changes your chars name and sometimes gender. Logout and login again, now you'll keep the "new" name and gender for ever. The same also goes for "Polymorph".

And I have seen this for js scripts. Like a campfire burning for ever if you restart the server, or when the last player logs out, while it was burning.

For things like those spells it would be sufficient to just reset their effects on a logout or server restart. But IMHO it would be better to store running timers and continue them when needed.

Posted: Mon Nov 07, 2005 2:20 am
by giwo
Some timers are attached to the socket, in which case they wouldn't survive logout. However the ones you mentioned should be stored on the characters, and thus function just fine despite logging out.

Posted: Mon Nov 07, 2005 2:22 am
by Grimson
giwo wrote:Some timers are attached to the socket, in which case they wouldn't survive logout. However the ones you mentioned should be stored on the characters, and thus function just fine despite logging out.
Well, they don't. At least not here.

Posted: Mon Nov 07, 2005 2:40 am
by giwo
Murder time is handled in the CheckAutoTimers() loop. It is run on GenericCheck() (which is running for that character, or that character would not be usable ;) ) And called when MurderTime != 0 and is <= the current time (so basically it stops running when you log out, comes back, as long as something has not set your murdertime to 0 (IE shutting down the server) it will run.

Notably I have modified this behavior for 3.2 so that anytime you have Kills it will run when Murdertime <= current time (so even if something set your murdertime to 0, it will start going again on the next loop). Also I will need to make that one persistent across worldsaves.

As for Incognito, that is in no way attached to your character, it is handled by TempEffects. Tempeffects handle just about every "condition" (poisoning, potions, you name it), and thus shouldn't be killed by logging out. Furthermore I see nothing that would kill it when you log out, even when you shut down the server (as tempeffects are saved, I believe). If it's definately not working after logout, there's a deeper issue there.

Posted: Mon Nov 07, 2005 3:08 am
by Grimson
giwo wrote:As for Incognito, that is in no way attached to your character, it is handled by TempEffects. Tempeffects handle just about every "condition" (poisoning, potions, you name it), and thus shouldn't be killed by logging out. Furthermore I see nothing that would kill it when you log out, even when you shut down the server (as tempeffects are saved, I believe). If it's definately not working after logout, there's a deeper issue there.
Then there is a deeper issue. I just made a new male mage, gave him incognito and polymorph. Used incognito which turned him into a female with a different name, logged out, logged back in (even without restarting the server). Even after 5 Minutes he's still a she with a different name. Next I used polymorph and turned him (her) into a demon. Logged out and back in, now he is a female demon with a different name, even after more than 10 minutes. It's somehow quite funny, but not really how it should work.

Btw. if I don't logout the spell effects go away after the proper time.

Posted: Mon Nov 07, 2005 7:28 am
by giwo
Yeah, should be about 90 seconds.

Thanks for testing that out, I'll track it down and fix it for 3.2 :)

Posted: Tue Feb 21, 2006 6:30 am
by giwo
JS Timers are now persistant across server shutdowns.


Just an extra note, to make you aware.... It is almost certain that any timed event you have scheduled before you save and shut down the server will be launched before you are able to log back into the server. This is because of the amount of time it takes to start up UOX3 (which is variable with every setup). So it would be wise to make VERY limited use of sockets in onTimer() functions.

Posted: Tue Feb 21, 2006 6:38 am
by Grimson
giwo wrote:Just an extra note, to make you aware.... It is almost certain that any timed event you have scheduled before you save and shut down the server will be launched before you are able to log back into the server. This is because of the amount of time it takes to start up UOX3 (which is variable with every setup). So it would be wise to make VERY limited use of sockets in onTimer() functions.
Or write the script so that it checks the socket first an resets the timer until the socket is valid ;).

Posted: Tue Feb 21, 2006 6:40 am
by giwo
Depending on the timer, that's a perfectly good solution, however I was thinking less so using the socket to send a sysmessage, etc, moreso I was thinking along the lines of using our temporary storage on the socket.

In other words, instead of socket.tempObj use myObj.SetTag() when passing something to a function on a timer. :)