![]() |
f_onserver_timer - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: Script Help (/Forum-Script-Help) +--- Thread: f_onserver_timer (/Thread-f-onserver-timer) |
f_onserver_timer - pinku - 11-22-2013 12:40 AM sphere.ini: Code: // Amount of minutes to call f_onserver_timer (0 disables this, default) spheretriggers: Code: [FUNCTION f_onserver_timer] This works, but multiply times on server time 13:00. (like 13:12, 13:45, 13:25)... The time seems to be pretty random too. The message came after 12, 13 and 15 minutes more or less, never exactly 10 minutes as stated on the .ini I want this to make some functions automated on the server. Can someone help me to improve this? I would like it to be at some exact time, but no clue on how to do that. Thanks everyone! RE: f_onserver_timer - Runcuks - 11-22-2013 03:13 AM try to set TimerCall=1 and than test, becouse if you start server for example 12:58, it will trigger only at 13:08 maybe that could solve your problem ^^ RE: f_onserver_timer - pinku - 11-22-2013 04:26 AM This way I would get messages every minute, according to what I posted.. (13:01, 13:02, 13:03...) That's not exactly what I am looking for. haha Thanks anyway! RE: f_onserver_timer - RanXerox - 11-22-2013 05:10 AM The server itself does not run according to a real-time clock... it uses its own timekeeping system called "ticks". Sometimes a tick takes a long time, sometimes short, which explains why it doesn't follow the real-time clock very closely. In the sphere ini file there are a bunch of settings that are described as "time it takes (in seconds) for..." In reality, those are all measured in "ticks" not "seconds". The ONLY functions in the server that are aware of the real-time clock are RTICKS and RTIME: RTICKS (Returns the real-world time, as a timestamp.) RTIME (Returns the real-world time, as a formatted string.) So if you need to time things in your game to a real-time clock, you need to use a scheduled timer (either f_onserver_timer or a TIMERF function - both of which are based on "ticks") and in your function, test the real-time clock and adapt accordingly depending on the precision you want. |