ID:2667310
 
(See the best response by F0lak.)
Hello. So I'm fairly new to this and I've been studying the other timer related posts to code in a system for event elegibility, but can't find an answer. Firstly, by consistent I mean 'won't implode with server crashes/resets and will be consistent with real life time' I imagine the only way to do this is making checks that rely on reading the computer's local time for both timers. Is there a way to do this?

I know it's better to have one timer running that procs something on everyone online, than have everyone running a timer. So I assume it's better to have a loop that just checks if 1 hour has passed and sets the vars accordingly, so that the effect can be procced again on the next 5 minute check. But this would require reading the time the proc was last procced on each player, and saving it as a var that the loop can read. I'm not sure if this is possible or not.

To try and clarify:

Event happens to player -> Loop reads the time and sets player as ineligible for 1 hour based on real time -> Loop reads if player is eligible every 5 minutes by checking the time -> Once an hour has passed the loop sets the player as eligible/or a different loop does this -> Next 5 min loop procs the event for the player again.

Would I have to set up an internal clock for the game that runs on in-game status ticks?
Best response
Ararararara wrote:
Hello. So I'm fairly new to this and I've been studying the other timer related posts to code in a system for event elegibility, but can't find an answer. Firstly, by consistent I mean 'won't implode with server crashes/resets and will be consistent with real life time' I imagine the only way to do this is making checks that rely on reading the computer's local time for both timers. Is there a way to do this?

For this, you want the world.time var

I know it's better to have one timer running that procs something on everyone online, than have everyone running a timer. So I assume it's better to have a loop that just checks if 1 hour has passed and sets the vars accordingly, so that the effect can be procced again on the next 5 minute check. But this would require reading the time the proc was last procced on each player, and saving it as a var that the loop can read. I'm not sure if this is possible or not.

Yes. This can be done by giving them a variable and when the proc is called, set this var to world.time

To try and clarify:

Event happens to player -> Loop reads the time and sets player as ineligible for 1 hour based on real time -> Loop reads if player is eligible every 5 minutes by checking the time -> Once an hour has passed the loop sets the player as eligible/or a different loop does this -> Next 5 min loop procs the event for the player again.

Would I have to set up an internal clock for the game that runs on in-game status ticks?

That’s one method. Check out kaio chaos Looper library. It can accomplish exactly what you’re looking for

http://www.byond.com/forum/post/2667370

I posted a snippet that related to this, because of your questions.