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.

Christmas & New Year Countdown

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
User avatar
n00bie
Voice
Posts: 7
Joined: Sun Nov 20, 2005 11:15 am
Location: localhost

Christmas & New Year Countdown

Post by n00bie »

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:
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

After RTFM (Reading The F*cking Manual) here I got to this:

Code: Select all

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
Last edited by Sir_Fz on Mon Dec 19, 2005 2:21 pm, edited 2 times in total.
User avatar
n00bie
Voice
Posts: 7
Joined: Sun Nov 20, 2005 11:15 am
Location: localhost

Post by n00bie »

:oops: thanks :oops:
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

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.
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Change the bind mask to "00 12 *" to have it announced at 12:00 every day.
Have you ever read "The Manual"?
A
Astur
Voice
Posts: 16
Joined: Fri Nov 23, 2007 10:27 am

Post by Astur »

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?
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

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?
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

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)
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

Sir_Fz wrote: it's PM (00 is AM)
Thanks, I will read some more in the famous manual :)
A
Astur
Voice
Posts: 16
Joined: Fri Nov 23, 2007 10:27 am

Post by Astur »

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 :)
w
wiiguy
Voice
Posts: 9
Joined: Fri Nov 30, 2007 3:30 pm

Post by wiiguy »

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 :)

thank for your time reading this
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

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].
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

Okay it's working nicely:

Code: Select all

[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?
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

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 :)

Code: Select all

# 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: Select all

# 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"?
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

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.
Post Reply