Real Life Timer - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere X (/Forum-Sphere-X) +--- Forum: Script Submissions (/Forum-Script-Submissions--61) +--- Thread: Real Life Timer (/Thread-Real-Life-Timer) |
Real Life Timer - ShiryuX - 04-04-2020 05:08 AM Hi, I didn't find an exact title for this, but anyway, this is a timer that is synced with your real life clock, it fires once per hour and you can configure specific functions for each day at a specific hour. Pretty simple actually. The clock will start automatically when the server is launched, you don't have to do anything, if anything happens (it gets deleted or something), a check is made at every world save. And last, if it gets out of sync, at each @Timer it will get synced again for the next hour. Every event is logged. Special thanks for the guys (Soulless and Xun) in Discord who gave me the idea to use rTime functions. Which I didn't know it existed NOTES: It will only work on o'clock timers. You can fire it at 16.00 but not at 16.15. Functions are fired on SERV, not on the object or anything else. Days start a 0 = Sunday, 1 = Monday and so on... Defname is provided with examples. YOU NEED TO CONFIGURE YOUR TIME ZONE CORRECTLY! Example defname: Code: [DEFNAME dWorldClockFunctions] Item for timer: Code: [ITEMDEF i_WorldClock] Look for f_onserver_save function in your default script pack. Or add it if you don't have one. Add the following code: Code: if (<uid.<var0.WorldClock>> == 0) Look for f_onserver_start function. Same as before. Add the following code: Code: if ((<var0.WorldClock> == 0) || (<uid.<var0.WorldClock>> == 0)) |