mIRC Homepage
Posted By: Kelven Need help with mIRCron script - 14/11/14 03:16 AM
First off I have to state, I have NO experience with scripting, other then creating a few very basic aliases.

I have this remote script called mIRCron, which reads lines from a text file and parses them into dates/times, and executes commands on those dates/times.

I need users in my channel to be able to trigger the script to say when the next scheduled command will be executed. Right now the script just runs the commands at the scheduled times, there's no way of knowing WHEN it'll be beforehand short of opening up the text file and looking at it.

The text file is formatted pretty easy to read, for example:

# +----------- minute (0 - 59)
# | +--------- hour (0 - 23)
# | | +------- day of month (1 - 31)
# | | | +----- month (1 - 12)
# | | | | +--- day of week (0 - 7) (Sunday=0 or 7)
# | | | | |
# * * * * * command to be executed

Therefore, this line:

Code:
5 4 * * 1 commandhere


Will execute "commandhere" on 4:05am on any date, any month, but only if it's a Monday. So essentially, every Monday at 4:05am that command will be executed. There can be as many of these scheduled tasks as you need inside the text file.

Currently, I use the script to announce to users when an event is starting, and when it ends. So for each event I have 2 schedules, one for the start time that announces to the channel when the event starts, and one for the end time that announces to the channel when the event ends.

What I'd need this new addition to do would be, when users type a trigger in the channel, the script will look through the text file that has the stored schedules in them, and find the next time an event will start, then let the channel know.

Would anyone be able to help me with this? The author of the script fully commented it so it's pretty easy to figure out what specific portions of the script do. But since I have no idea wtf any of this means I don't know HOW it does it, or what I'd need to add to give it this extra functionality.

Here's the script itself: http://pastebin.com/uryWhM2t
Here's the crontab.txt file that it reads from: http://pastebin.com/ksuj9jnP

If anyone could help I'd greatly appreciate it.
© mIRC Discussion Forums