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.
[FIXED] Bug: Timers don't survive logouts/server restarts
-
giwo
- Developer
- Posts: 1780
- Joined: Fri Jun 18, 2004 4:17 pm
- Location: California
- Has thanked: 0
- Been thanked: 0
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.
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.
Scott
-
Grimson
- Developer
- Posts: 802
- Joined: Sat Jun 04, 2005 1:52 am
- Location: Germany
- Has thanked: 0
- Been thanked: 0
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.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.
Btw. if I don't logout the spell effects go away after the proper time.
-
giwo
- Developer
- Posts: 1780
- Joined: Fri Jun 18, 2004 4:17 pm
- Location: California
- Has thanked: 0
- Been thanked: 0
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.
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.
Scott
-
Grimson
- Developer
- Posts: 802
- Joined: Sat Jun 04, 2005 1:52 am
- Location: Germany
- Has thanked: 0
- Been thanked: 0
Or write the script so that it checks the socket first an resets the timer until the socket is validgiwo 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.
-
giwo
- Developer
- Posts: 1780
- Joined: Fri Jun 18, 2004 4:17 pm
- Location: California
- Has thanked: 0
- Been thanked: 0
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.
In other words, instead of socket.tempObj use myObj.SetTag() when passing something to a function on a timer.
Scott