mIRC Home    About    Download    Register    News    Help

Print Thread
#16052 19/03/03 03:39 PM
Joined: Dec 2002
Posts: 26
F
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Dec 2002
Posts: 26
I've been studying the 'timer' commands.
I'm trying to get a D Day timer.

for example:
It's 2 hours and 20 minutes till XXXX

Where I set a date and time and the script counts down to that date/time.

I've looked at the time commands and can't seem to come up with an idea.

#16053 19/03/03 03:58 PM
Joined: Mar 2003
Posts: 272
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Mar 2003
Posts: 272


- cF
Dedicated helper for rent.
#16054 19/03/03 04:58 PM
Joined: Dec 2002
Posts: 26
F
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Dec 2002
Posts: 26
Actually I spent quite a while on Google trying to find something.
But I must have asked the wrong questions.

I won't bother anyone here any further

#16055 19/03/03 05:15 PM
Joined: Dec 2002
Posts: 143
A
Vogon poet
Offline
Vogon poet
A
Joined: Dec 2002
Posts: 143
if you just want it to echo to the active window or msg (you'll have to change the code) then use something like:

Code:
alias DDayTimer {
  :ask user to enter date/time combination
  set %DDayTime $$?="Enter date in this format: dd/mm/yy hh:nn:ss (e.g. 28/03/03 14:30:00)"
  ;convert this combination to seconds
  set %DDayTime $ctime(%DDayTime)
  ;If the variable does not contain numbers, return an error
  if (%DDayTime !isnum) { echo -a You must specify a valid date/time combination(1) | halt }
  ;If user entered a date that hasd passed, return an error
  if ($calc(%DDayTime - $ctime) <= 0) { echo -a You must specify a valid date/time combination(2) | halt }
  .timerDDayTimer1 1 $calc(%DDayTime - $ctime) { echo -a BANG! It's $asctime(HH:nn:ss) on $asctime(dddd dd mmmm yyyy) | timerDDayTimer2 off }
  .timerDDayTimer2 0 5 echo -a it's $calc(%DDayTime - $ctime) seconds till $asctime(%DDayTime)
}


Haven't got time to go through it, sorry, just leaving work!

Not tested it either! - It's something to start you off anyway...

Hope it helps in some way!


Aubs.
cool

#16056 19/03/03 05:25 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Here's a simple alias that will return the time between when it's called and the date given:
Code:
time_until {
  ; Usage: $time_until([color:green]date[/color],[color:green] negative_time[/color])
  ; Where [color:green]date[/color] can be in any of the following formats:
  ;     January 1 1970 00:00:00
  ;     3rd August 1987 3:46pm
  ;     21/4/72 1:30:37
  ;     Wed 1998-3-27 21:16
  ; If [color:green]negative_time[/color] is a true value (not 0, $false, or $null) then negative dates will return negative values,
  ; otherwise they return 0
  var %time = $calc($ctime($$1) - $ctime)
  if ($2) return $+($iif(%time < 0,-),$duration($abs(%time)))
  return 0
}


Of course you can delete the comments when you use the code if you like (lines starting with ; ). If you don't understand any part of that I can explain it better.


Spelling mistakes, grammatical errors, and stupid comments are intentional.

Link Copied to Clipboard