SphereCommunity
Sphere Timer - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: General Help (/Forum-General-Help)
+--- Thread: Sphere Timer (/Thread-Sphere-Timer)



Sphere Timer - Darkyhood - 04-11-2013 08:37 AM

Noticed that timer = 60 a little more than 60 seconds.
I made a log every second (attached file) and we can see:
Code:
12:07 Timer = 1
12:08 Timer = 1
12:09 Timer = 1
12:10 Timer = 1
12:12 Timer = 1
...
12:38 Timer = 1
12:40 Timer = 1
...
13:00 Timer = 1
13:02 Timer = 1
...
13:33 Timer = 1
13:35 Timer = 1
Timer jumps few times per minute, it turns out that the timer=60 is more than 1 minute for 2-3 seconds. Per hour is 2-3 minutes...

Is it possible to somehow fix it?

P.S. Sorry for my English.


RE: Sphere Timer - Shaklaban - 04-11-2013 01:56 PM

timers can be affected by sector sleep, you can use timerf or f_onserver_timer for time-critical things.


RE: Sphere Timer - Darkyhood - 04-12-2013 03:12 AM

I think sector sleep affect only for NPC. I just try make premium account timer. I create item, equip it to player and saw that timer is not same like real time seconds.

If is not possible to fix I can try found other ways, like you said (timerf or f_onserver_timer) maybe I can use serv.time as well.

Anyway thanks for helping.


RE: Sphere Timer - Wap - 04-12-2013 05:43 AM

I have a system object on the shard market(sector is always active), on that continuosly working:
TIMERD=1 -->

ON=@TIMER
SERV.RTICKS check, if changed ---> fire SERVER_TIMERS function.
TIMERD=1

I know no other way to fire some code exactly on time X, or after X seconds.

But for making Premium Account timer, you can just save SERV.RTICKS time, then premium account is activated, and check it regularly(on login, any other actions...).