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 

Christmas & New Year Countdown
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
n00bie
Voice


Joined: 20 Nov 2005
Posts: 7
Location: localhost

PostPosted: Mon Dec 19, 2005 2:21 am    Post subject: Christmas & New Year Countdown Reply with quote

Hello Guys, is there any one who can make a tcl scripts for counting down the christmas & new year day, the bot will announce on the set channel every 10 minutes on #countdown channel.

Example: <@Bot> 6 days, 144hours and 5184000 minutes before Christmas [25th December] and some days, some hours, some minutes before New Year [1st January, 2006]

i want the bot to announce that every 10 minutes on the channel and also to set on the topic how many days only before christmas & new year ... umm... if it can be done, i want the bot to set the topic only once a day, not every 10 minutes .. i hope you guys understand my english ... thanks Wink
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Mon Dec 19, 2005 8:02 am    Post subject: Reply with quote

After RTFM (Reading The F*cking Manual) here I got to this:
Code:
bind time - "?0 *" count:down

proc count:down args {
 set christmas "[duration [expr {[clock scan 12/25/05] - [clock seconds]}]]"
 set newyear "[duration [expr {[clock scan 01/01/06] - [clock seconds]}]]"
 puthelp "PRIVMSG #channel :$christmas before Christmas \[25th December\] and $newyear before New Year \[1st January, 2006\]"
}

this will msg #channel every 10 minutes the time left before christmas and new year. As for posting the topic every day, the search function will help you.

Edit: fixed a fragment in my last sentence
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts


Last edited by Sir_Fz on Mon Dec 19, 2005 2:21 pm; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website
n00bie
Voice


Joined: 20 Nov 2005
Posts: 7
Location: localhost

PostPosted: Mon Dec 19, 2005 1:16 pm    Post subject: Reply with quote

Embarassed thanks Embarassed
Back to top
View user's profile Send private message
starpossen
Op


Joined: 10 Jan 2006
Posts: 139

PostPosted: Wed Dec 05, 2007 8:33 am    Post subject: Reply with quote

I know this is an old topic, but where would I change the time between announcing?
I'd like it to announce once every 24 hours.
Back to top
View user's profile Send private message
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Wed Dec 05, 2007 9:50 am    Post subject: Reply with quote

Change the bind mask to "00 12 *" to have it announced at 12:00 every day.
_________________
Have you ever read "The Manual"?
Back to top
View user's profile Send private message
Astur
Voice


Joined: 23 Nov 2007
Posts: 16

PostPosted: Wed Dec 05, 2007 11:24 am    Post subject: Reply with quote

Is it possible to have the time in German? (weeks= Wochen, days= Tage, hours= Stunden, minutes= Minuten and seconds= Sekunden)

What I have to change?
Back to top
View user's profile Send private message
starpossen
Op


Joined: 10 Jan 2006
Posts: 139

PostPosted: Wed Dec 05, 2007 12:17 pm    Post subject: Reply with quote

user wrote:
Change the bind mask to "00 12 *" to have it announced at 12:00 every day.


Thanks alot, i've looked at the manual, and was wondering, the 12:00 is that AM or PM?
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Wed Dec 05, 2007 1:33 pm    Post subject: Reply with quote

Astur wrote:
Is it possible to have the time in German? (weeks= Wochen, days= Tage, hours= Stunden, minutes= Minuten and seconds= Sekunden)

What I have to change?

You can apply [string map] over the output (i.e. [string map {weeks Wochen} <output>]). Try it.
starpossen wrote:
Thanks alot, i've looked at the manual, and was wondering, the 12:00 is that AM or PM?

it's PM (00 is AM)
_________________
Follow me on GitHub

- Opposing

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


Joined: 10 Jan 2006
Posts: 139

PostPosted: Wed Dec 05, 2007 1:38 pm    Post subject: Reply with quote

Sir_Fz wrote:

it's PM (00 is AM)


Thanks, I will read some more in the famous manual Smile
Back to top
View user's profile Send private message
Astur
Voice


Joined: 23 Nov 2007
Posts: 16

PostPosted: Wed Dec 05, 2007 2:26 pm    Post subject: Reply with quote

Sir_Fz wrote:
Astur wrote:
Is it possible to have the time in German? (weeks= Wochen, days= Tage, hours= Stunden, minutes= Minuten and seconds= Sekunden)

What I have to change?

You can apply [string map] over the output (i.e. [string map {weeks Wochen} <output>]). Try it.


Thanks, it works Smile
Back to top
View user's profile Send private message
wiiguy
Voice


Joined: 30 Nov 2007
Posts: 9

PostPosted: Wed Dec 05, 2007 3:53 pm    Post subject: Reply with quote

i live in the time zone gmt+1

how do that work ?
and i want at the last minute of new year or cristmas it will count off from 10 seconds Smile

thank for your time reading this
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Wed Dec 05, 2007 5:48 pm    Post subject: Reply with quote

wiiguy wrote:
i live in the time zone gmt+1

You'll have to figure out what time zone your bot's on and add/subtract hour(s). For example if the bot's timezone is gmt+2, you'll have to subtract 3600 seconds from [clock seconds].
_________________
Follow me on GitHub

- Opposing

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


Joined: 10 Jan 2006
Posts: 139

PostPosted: Thu Dec 06, 2007 7:26 am    Post subject: Reply with quote

Okay it's working nicely:
Code:

[12:00:07] <@Bot> 2 weeks 3 days 12 hours untill Christmas [24th December]


But i'd like to change it, so it only shows days, and not weeks, I have been looking at that manual mentioened earlier, but I have to admit, i'm a bit lost on this one.

Any help?
Back to top
View user's profile Send private message
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Thu Dec 06, 2007 8:12 am    Post subject: Reply with quote

starpossen wrote:
i'd like to change it, so it only shows days, and not weeks

That can't be done using the built in duration command, but you can make your own Smile
Code:
# standard english names
set duration_en {
   31536000 {" year"   " years"}
   604800   {" week"   " weeks"}
   86400    {" day"    " days"}
   3600     {" hour"   " hours"}
   60       {" minute" " minutes"}
   1        {" second" " seconds"}
}
# abbreviated english names
set duration_en_compact {
   31536000 {"y" "y"}
   604800   {"w" "w"}
   86400    {"d" "d"}
   3600     {"h" "h"}
   60       {"m" "m"}
   1        {"s" "s"}
}
#  english names, but no years/weeks
set duration_en_custom {
   86400    {" day"    " days"}
   3600     {" hour"   " hours"}
   60       {" minute" " minutes"}
   1        {" second" " seconds"}
}
# rename this proc if you want to keep the built in "duration" command
proc duration {time {lang en} {join " "}} {
   set out {}
   foreach {secs names} [set ::duration_$lang] {
      if {$time<$secs} continue
      set val [expr {$time/$secs}]
      lappend out $val[lindex $names [expr {$val!=1}]]
      if {![incr time [expr {-$val*$secs}]]} break
   }
   join $out $join
}

Code:
# tests:
% duration 3317790
5 weeks 3 days 9 hours 36 minutes 30 seconds
% duration 3317790 en_compact
5w 3d 9h 36m 30s
% duration 3317790 en_custom
38 days 9 hours 36 minutes 30 seconds

_________________
Have you ever read "The Manual"?
Back to top
View user's profile Send private message
starpossen
Op


Joined: 10 Jan 2006
Posts: 139

PostPosted: Thu Dec 06, 2007 5:48 pm    Post subject: Reply with quote

Will try and mess around with that, by the way, I was wondering, would it be possible to a public command to show time left until set date?
like !xmas
and bot would respond with the timeleft.
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 -> Script Requests All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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