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 

Kind of Countdown

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
traxx
Voice


Joined: 03 Jan 2006
Posts: 11

PostPosted: Thu May 04, 2006 4:46 pm    Post subject: Kind of Countdown Reply with quote

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!
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu May 04, 2006 8:33 pm    Post subject: Reply with quote

Code:
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."
 }
}

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
traxx
Voice


Joined: 03 Jan 2006
Posts: 11

PostPosted: Fri May 05, 2006 7:54 am    Post subject: Reply with quote

thanks for your answer, but for some strange reason the bot doesn't do anything Sad
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri May 05, 2006 10:01 am    Post subject: Reply with quote

Did you change #channel to your #channelname?
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
traxx
Voice


Joined: 03 Jan 2006
Posts: 11

PostPosted: Fri May 05, 2006 11:20 am    Post subject: Reply with quote

yap, i did Smile
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri May 05, 2006 12:03 pm    Post subject: Reply with quote

Code:
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.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts


Last edited by Sir_Fz on Fri May 05, 2006 7:27 pm; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website
traxx
Voice


Joined: 03 Jan 2006
Posts: 11

PostPosted: Fri May 05, 2006 4:24 pm    Post subject: Reply with quote

Thanks, working perfectly, but... Smile

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!
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri May 05, 2006 7:28 pm    Post subject: Reply with quote

I edited the code above to do so.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests 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