This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Kind of Countdown

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
t
traxx
Voice
Posts: 11
Joined: Tue Jan 03, 2006 7:23 am

Kind of Countdown

Post by traxx »

Hi there,

could anyone please help me doing the following:
The bot should post a message every 3 hours. The content should be this:

"A new feature will be available by March 16 2006. Until then there are still X months, X days and X minutes."

It would be really great if somebody could help me.

Thanks in advance!
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

set reachdate mm/dd/yy

bind time - * postmsg

proc postmsg {m h args} {
 global reachdate
 if {!([scan $h %d]%3)} {
  set date [clock scan $reachdate]
  set fulldate [clock format $date -format "%B %d %Y"]
  set dur [duration [expr {$date-[clock seconds]}]]
  puthelp "privmsg #channel :A new feature will be available by $fulldate. Until then there are still $dur."
 }
}
t
traxx
Voice
Posts: 11
Joined: Tue Jan 03, 2006 7:23 am

Post by traxx »

thanks for your answer, but for some strange reason the bot doesn't do anything :(
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Did you change #channel to your #channelname?
t
traxx
Voice
Posts: 11
Joined: Tue Jan 03, 2006 7:23 am

Post by traxx »

yap, i did :)
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

set reachdate mm/dd/yy

bind time - "00 *" postmsg

proc postmsg {m h args} {
 global reachdate
 if {[scan $h %d]%3 == 0} {
  set date [clock scan $reachdate]
  set fulldate [clock format $date -format "%B %d %Y"]
  set dur [germanize [duration [expr {$date-[clock seconds]}]]]
  puthelp "privmsg #channel :A new feature will be available by $fulldate. Until then there are still $dur."
 }
}

proc germanize str {
 regsub -nocase {week(s?)} $str "wochen" str
 regsub -nocase {hour(s?)} $str "stunden" str
 regsub -nocase {day(s?)} $str "tage" str
 set str
}
Edit: added translating weeks, hours, and days to german.
Last edited by Sir_Fz on Fri May 05, 2006 7:27 pm, edited 2 times in total.
t
traxx
Voice
Posts: 11
Joined: Tue Jan 03, 2006 7:23 am

Post by traxx »

Thanks, working perfectly, but... :)

I wonder if it's possible to replace "weeks", "hours" and "days" in the time expression by it's german equivalents "wochen", "stunden" and "tage".

It would be great if anyone was so kind to explain that to me.

Thanks a lot!
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

I edited the code above to do so.
Post Reply