Cron for MUSHclient

Posted by Shaun Biggs on Thu 14 Jun 2007 07:46 PM — 7 posts, 27,859 views.

USA #0
I'd like to have a few timers fire at specific points in time. Like at midnight, or every hour on the hour. I've started making a scheduler plugin which will allow me to do this by making triggers offset by the difference between the current time and the target time, then proceeding as normal. Is there a simpler way to do this already in MUSHclient? Some sort of "do this at this specific time" function, perhaps.

Either way I'll probably keep making the plugin, because it would be nice to have some sort of scheduler where all of this can be dealt with in one place.
Australia Forum Administrator #1
Timers already have an option to fire at a specific time. Check out the GUI interface, it has always been there.
USA #2
That will fire on one specific time, but not every half hour, for example, correct? You would have to set it up to fire once, and then another one to fire every half hour after that, as far as I can tell. Sorry for being a bit unclear. I knew about the once per day part, but I couldn't figure out a way to just have it fire on *:30 or anything like that. Or similar to cron "0,15,30,45 * * * *"
Amended on Thu 14 Jun 2007 11:00 PM by Shaun Biggs
Australia Forum Administrator #3
Yes, one specific time, per day. You initially said "at midnight", so that would do that. You also said 'some sort of "do this at this specific time" function, perhaps.' - I was addressing that request.

For every hour on the hour, you could simply script adding 24 timers, one for each hour, each of which calls the same script function.

This could messy for every 30 minutes, so in that case I would make one that fires every minute (say), and checks against a table (probably like Cron does), to see if it is really time to do something. The overhead would be minimal, and then you could make quite a fancy table that controls its behaviour.
USA #4
As I said, I am mostly using a Lua script to set up an offset for each timer, then timing for every 30 min. after that.

For the "at this specific time," my apologies again for being unclear. I meant as in every 30 minutes on the half hour and whole hour, ex: 1:30, 2:00, 2:30, etc. Even if I start up MUSHclient at 1:15. The overhead is a bit less if I just set everything up at connection off of a quick table than checking every minute, but I've used the every minute one and didn't notice any slowdown at all like that, even on my old p233 laptop. I just needed to condense everything into something I could mentally keep track of a bit easier.

Thank you again for all your help. Things got clarified quite a bit for me in just a few quick posts.
Greece #5
Actually, if you wanted to make this plugin (assuming you don't mind all the timers being in one place and not in their world files, but since you're making it you probably don't), I think it wouldn't be very hard to make one timer that fires every minute to check a sort of crontab file for the functions to call...
Amended on Fri 22 Jun 2007 01:24 PM by Poromenos
USA #6
It's actually quite convenient with Lua tables, since you can just have functions reference whatever spot of the table that relates to now. If nothing exists, the hash file runs nothing, and if something does exist, it's dynamically linked to whatever command you have listed.