Countdown

By Daveoh on Jun 23, 2007

This is a simple local countdown script, which will count down and from a date.

Usage: /countdown
Acceptable formats for date:January 1 1970 00:00:00
3rd August 1987 3:46pm
21/4/72 1:30:37
Wed 1998-3-27 21:16
Example:
Image

;;Countdown script
;;By Daveoh
alias countdown {
  if ($1 == drawwin) {
    if !$window(@Countdown) { .timercountdown off | halt }
    window @Countdown -1 -1 $calc($width($duration($calc($ctime($2-) - $ctime)),Arial,40)+8) $calc($height($duration($calc($ctime($1-) - $ctime)),Arial,40)+28)
    drawtext -br @Countdown 16777215 0 Arial 40 0 0 $duration($calc($ctime($2-) - $ctime))
    halt
  }
  if !$ctime($1-) { echo -ag * /countdown: insufficient parameters | halt }
  window -Cdk0p +t @Countdown -1 -1 $calc($width($duration($calc($ctime($1-) - $ctime)),Arial,40)+8) $calc($height($duration($calc($ctime($1-) - $ctime)),Arial,40)+28)
  drawtext -br @Countdown 16777215 0 Arial 40 0 0 $duration($calc($ctime($1-) - $ctime))
  .timercountdown -h 0 1000 countdown drawwin $1-
}

Comments

Sign in to comment.
Olliegod   -  Jun 27, 2007

Well since it\'s meant to count from the date, maybe make it so it doesn\'t only give seconds. For example: -1 minute 34 seconds.

 Respond  
Daveoh   -  Jun 26, 2007

I explained in the intro that this script will count down AND FROM a date.
The amount of CPU used by the timer seems minimal, the CPU usage of mIRC for me is usually under 1% using the script or not. The only point of the switch is so that the countdown does not go out of sync from what it should be, otherwise you could be seconds to minutes out.

 Respond  
Lindrian   -  Jun 26, 2007

Except the flaw that it goes -, I guess its alright.

I dont think the -h switch is so good.

Note: The -h switch creates a high-resolution multimedia timer. This type of timer should only be used in critical timer situations since it uses system resources heavily.

 Respond  
Olliegod   -  Jun 23, 2007

Well once it reaches the time specified it goes to negative seconds. Perhaps make it say Time Reached or something of the sort and stop updating? And I\'m not sure of why the timer has to be high resolution, I would think .timercountdown 0 1 would be good enough.

 Respond  
HeLL_MasTeR   -  Jun 23, 2007

Yeah this is nice.. nice job Daveoh :)

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.