egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

bind time [SOLVED]

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
cache
Master


Joined: 10 Jan 2006
Posts: 306
Location: Mass

PostPosted: Wed Jul 07, 2010 3:04 pm    Post subject: bind time [SOLVED] Reply with quote

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
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Thu Jul 08, 2010 2:15 am    Post subject: Re: bind time Reply with quote

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
View user's profile Send private message
pseudo
Halfop


Joined: 23 Nov 2009
Posts: 88
Location: Bulgaria

PostPosted: Thu Jul 08, 2010 3:31 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Thu Jul 08, 2010 10:56 am    Post subject: Reply with quote

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! Very Happy
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
View user's profile Send private message
cache
Master


Joined: 10 Jan 2006
Posts: 306
Location: Mass

PostPosted: Thu Jul 08, 2010 3:02 pm    Post subject: Reply with quote

Thanks, you guys rock! Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber