When? Once? Right after midnight? .... or what?COBRa wrote: ...
so as the week progresses the display would show
...
Not really.COBRa wrote:the countdown for the week would be constantly displayed so as the week progresses it would count down by day until the week is over
so as of sunday 00.01 the display would show
7 day/s to go
then as of monday 00.01 the display would show
6 day/s to go and so on till the week is over then then rest itsself as to start again
hope tht makes sence
Code: Select all
# Feb. 24, 2015
# http://forum.egghelp.org/viewtopic.php?p=103540#103540
###########
#set the channel in which to do the announcement
set announce_chan #eggdrop
###########
###########
bind cron - "01 00 * * 0" sunday_announce
bind cron - "01 00 * * 1" monday_announce
bind cron - "01 00 * * 2" tuesday_announce
bind cron - "01 00 * * 3" wednesday_announce
bind cron - "01 00 * * 4" thursday_announce
bind cron - "01 00 * * 5" friday_announce
bind cron - "01 00 * * 6" saturday_announce
proc sunday_announce {min hour day month weekday} {
global announce_chan
putserv "privmsg $announce_chan :7 day/s to go"
}
proc monday_announce {min hour day month weekday} {
global announce_chan
putserv "privmsg $announce_chan :6 day/s to go"
}
proc tuesday_announce {min hour day month weekday} {
global announce_chan
putserv "privmsg $announce_chan :5 day/s to go"
}
proc wednesday_announce {min hour day month weekday} {
global announce_chan
putserv "privmsg $announce_chan :4 day/s to go"
}
proc thursday_announce {min hour day month weekday} {
global announce_chan
putserv "privmsg $announce_chan :3 day/s to go"
}
proc friday_announce {min hour day month weekday} {
global announce_chan
putserv "privmsg $announce_chan :2 day/s to go"
}
proc saturday_announce {min hour day month weekday} {
global announce_chan
putserv "privmsg $announce_chan :1 day to go"
}
Code: Select all
# Feb. 24, 2015
# http://forum.egghelp.org/viewtopic.php?p=103540#103540
####
#set the channel in which to do the announcement
set announce_chan #eggdrop
###########
bind cron - "01 00 * * *" days2go_announce
proc days2go_announce {min hour day month weekday} {
global announce_chan
if {[strftime %u] == "6"} {
putserv "privmsg $announce_chan :1 day to go"
}
if {[strftime %u] == "5"} {
putserv "privmsg $announce_chan :2 days to go"
}
if {[strftime %u] == "4"} {
putserv "privmsg $announce_chan :3 days to go"
}
if {[strftime %u] == "3"} {
putserv "privmsg $announce_chan :4 days to go"
}
if {[strftime %u] == "2"} {
putserv "privmsg $announce_chan :5 days to go"
}
if {[strftime %u] == "1"} {
putserv "privmsg $announce_chan :6 days to go"
}
if {[strftime %u] == "0"} {
putserv "privmsg $announce_chan :7 days to go"
}
}
Code: Select all
bind cron - "01 00 * * *" days2go:announce
proc days2go:announce {min hour day month weekday} {
set days [expr 7 - [strftime %u]]
puthelp "privmsg #announce_chan :[expr {$days==1?"1 day":"$days days"}] to go!"
}
I was hoping that it might be so easy to follow that the original poster would be wanting to explore learning some basic TCL for him/her self.caesar wrote: Yeah, instead of multiple if statements you could go with switch. Apart this, good idea willyw.
Did you mean to say $weekday?...
Not 100% sure and can't test right now, but i think we can use $day variable as well but I'd expect it to have an leading zero, but no problem with that.
Code: Select all
bind cron - "01 00 * * *" days2go:announce
proc days2go:announce {min hour day month weekday} {
set days [expr 7 - [strftime %u]]
puthelp "privmsg #announce_chan :[expr {$days==1?"1 day":"$days days"}] to go!"
}
Code: Select all
[expr {$days==1?"1 day":"$days days"}]
Code: Select all
set days2go [expr {$days==1?"1 day":"$days days"}]
Code: Select all
proc days2go:announce {min hour day month weekday} {
global days2go
... rest of the code
Yes.COBRa wrote: ... is bind cron supported in ver 1.6.21...
This is not enough information for us to be able to try to help you....as it kills the bot...
This is not enough information for us to be able to try to help you....when I add the cron line ...
Maybe. We can't guess as to which way might be best, until we see what you are trying to do.... if not could it be done with bind time plz