| View previous topic :: View next topic |
| Author |
Message |
cache Master
Joined: 10 Jan 2006 Posts: 306 Location: Mass
|
Posted: Wed Jul 07, 2010 3:04 pm Post subject: bind time [SOLVED] |
|
|
Need help with bind time, trying to get the bot to say something every monday and thursday at 9am.
day is a zero padded two digit integer 01 through 31 representing day of the month.
Does this mean I need to make a proc for every month since the days aren't the same for each month? Like the 15th could be monday for one month then next month it could be tuesday. Not an issue if I have to, just wonder if there is a short way?
Thanks
Last edited by cache on Thu Jul 08, 2010 3:07 pm; edited 1 time in total |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Thu Jul 08, 2010 2:15 am Post subject: Re: bind time |
|
|
| cache wrote: | Need help with bind time, trying to get the bot to say something every monday and thursday at 9am.
day is a zero padded two digit integer 01 through 31 representing day of the month.
Does this mean I need to make a proc for every month since the days aren't the same for each month? Like the 15th could be monday for one month then next month it could be tuesday. Not an issue if I have to, just wonder if there is a short way?
Thanks |
How about using bind time to run a proc every day at 9:00, and within that proc check to see if today is Monday or Thursday?
Something like this:
| Code: |
bind time - "* 09 * * *" time_demo
proc time_demo {min hour day month year} {
if {"[strftime %A]"=="Monday"} {
## commands to say what you want to say on Monday go here
}
if {"[strftime %A]"=="Thursday"} {
#commands to say what you want to say on Thursday go here
}
}
|
References:
http://www.baschny.de/eggdrop/faq/faq-f.html
and find the section on bind time
tcl-commands.doc for strftime command, and also:
http://linux.about.com/library/cmd/blcmdl3_strftime.htm
for a nice list of the formats.
I'm half asleep... I hope I got it right. With some quick testing, as best I could, ... it worked.
I hope this helps. |
|
| Back to top |
|
 |
pseudo Halfop
Joined: 23 Nov 2009 Posts: 88 Location: Bulgaria
|
Posted: Thu Jul 08, 2010 3:31 am Post subject: |
|
|
With the new 1.6.20rc1, you could use bind cron instead of bind time which simplifies the job.
Example: bind cron - "00 09 * * 01,04" your_proc
This will trigger every Monday and Thursday at 9AM. |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Thu Jul 08, 2010 10:56 am Post subject: |
|
|
| pseudo wrote: | With the new 1.6.20rc1, you could use bind cron instead of bind time which simplifies the job.
Example: bind cron - "00 09 * * 01,04" your_proc
This will trigger every Monday and Thursday at 9AM. |
Hey, hey!
This is news!
I didn't even know there was a newer version of Eggdrop out. You caused me to go look, and I found it was dated just yesterday.
Reminds me of this thread that I started, some time ago:
http://forum.egghelp.org/viewtopic.php?t=17477
Thank you for mentioning it. |
|
| Back to top |
|
 |
cache Master
Joined: 10 Jan 2006 Posts: 306 Location: Mass
|
Posted: Thu Jul 08, 2010 3:02 pm Post subject: |
|
|
Thanks, you guys rock!  |
|
| Back to top |
|
 |
|