mIRC Homepage
Posted By: Derek1316 Countdown Timer - 12/09/06 10:20 PM
I want a countdown timer. In my channel (a clan channel), we have events and stuff and i just want a timer that i can set to the next event and it will say there is... So and so many days hrs, mins, secs like that. Can someone please help me?
Posted By: Riamus2 Re: Countdown Timer - 12/09/06 10:48 PM
Here's a simple timer... though you could probably search the forum and find multiple scripts for countdown timers.

Code:
alias countdown {
  if ($1) {
    .timercountdown 0 3600 DisplayCountDown $1-
  }
  else echo -a ERROR:  Please provide a date for the timer.
}
alias DisplayCountDown {
  if ($ctime($1-) < $ctime) { .timercountdown off | return }
  msg #yourchannel Your event will start in $duration($calc($ctime($1-) - $ctime))
}

Change the "3600" (60 minutes) to whatever time limit you want for the message to display in the channel. Also, change #yourchannel to the channel you want.

USE: /countdown Oct 31 2006 16:00
USE: /countdown Oct 31 2006 4:00pm

You can also use dates like 4/6/2007, but keep in mind that mIRC treats that as European style dates... the month is the 6 and the day is the 4. And you can just include a date or just a time, rather than both if you want to.

Note that if you want months and years, you might consider using the $DateXpander identifier I wrote as it will accurately display months and years... even with leap years. You can find it on mircscripts.org along with information on how to use it for a variety of things.

Finally, if you want to display the information at a time other than just when the timer triggers, just use:

/DisplayCountDown Oct 31 2006 4:00pm

or similar.
Posted By: Derek1316 Re: Countdown Timer - 13/09/06 12:34 AM
Thats not working i typed in the /countdown thing and it didn't work
Posted By: Lpfix5 Re: Countdown Timer - 13/09/06 01:42 AM
well the reason why its not showing is because the timer is set to silent and will only display in 3600 seconds so you wont see nothing till 3600 however if you want something right away then

Code:
alias countdown {
  if ($1) {
[color:red]DisplayCountDown $1-[/color]
    .timercountdown 0 3600 DisplayCountDown $1-
  }
  else echo -a ERROR:  Please provide a date for the timer.
}
alias DisplayCountDown {
  if ($ctime($1-) < $ctime) { .timercountdown off | return }
  msg #yourchannel Your event will start in $duration($calc($ctime($1-) - $ctime))
}
Posted By: Riamus2 Re: Countdown Timer - 13/09/06 04:35 AM
Yeah, sorry. I didn't think about pointing that out. Usually people don't need it right away for something like that. Anyhow, like I mentioned, you can always just type the second alias to get the message whenever you want it. The first part is just to do the repeating message every X seconds.
© mIRC Discussion Forums