mIRC Homepage

Help with "countdown" command.

Posted By: Artiiz

Help with "countdown" command. - 31/07/15 09:18 PM

Hello,

I'm wondering if there's a way to make a countdown script like this one:
http://imgur.com/6zDBYBk

So that when I type like !stream or whatever, it says how long time there is until that exact time.
I know that with Nightbot you type:

Code:
$(countdown 01/01/2015 10:00 AM GMT +1)


Then that makes a countdown script from today until the date & time that'st written in there.

Grateful for help, and knowing if there is a possible way of making it, or if it's not possible.

Thank you!
Posted By: Nillen

Re: Help with "countdown" command. - 31/07/15 09:33 PM

Code:
alias todate {
var %month = $1
var %day = $$2
var %year = $asctime(yyyy)

var %todate = $calc($ctime($+(%day,-,%month,-,%year) 00:00:00) - $ctime)
if (%todate < 0) {
inc %year
%todate = $calc($ctime($+(%day,-,%month,-,%year) 00:00:00) - $ctime)
}
return %todate
}
Not my own, taken from someone elses sript.
Posted By: Artiiz

Re: Help with "countdown" command. - 31/07/15 09:47 PM

Originally Posted By: Nillen
Code:
alias todate {
var %month = $1
var %day = $$2
var %year = $asctime(yyyy)

var %todate = $calc($ctime($+(%day,-,%month,-,%year) 00:00:00) - $ctime)
if (%todate < 0) {
inc %year
%todate = $calc($ctime($+(%day,-,%month,-,%year) 00:00:00) - $ctime)
}
return %todate
}
Not my own, taken from someone elses sript.



Thanks!

Excuse me for being noobish, but just have question about that one.

I should put it just straight into Remotes, along with
Code:
on 1:TEXT:!test:#artiiz:{

right?

And, should i replace the "-" with current date and the date I want it to count to?

Thanks for taking time to help smile
Posted By: Artiiz

Re: Help with "countdown" command. - 06/08/15 01:17 PM

Anyone could answer if I'm doing the right thing?
Doesn't seem to work when I just put in the text and replace the "-" with the date & time I want it to be.
Posted By: Nillen

Re: Help with "countdown" command. - 06/08/15 01:34 PM

Don't replace anything.

//echo -a $duration($todate(04,29)) will return how many weeks, hours, minutes and seconds it is until April 29th next year.
Posted By: Artiiz

Re: Help with "countdown" command. - 11/08/15 06:17 PM

Originally Posted By: Nillen
Don't replace anything.

//echo -a $duration($todate(04,29)) will return how many weeks, hours, minutes and seconds it is until April 29th next year.


So I should put like this into "Remote"?

Code:
on 1:TEXT:!test:#artiiz:{
  if ((%floodtest) || ($($+(%,floodtest.,$nick),2))) { return }
  set -u0 %floodtest On
  set -u0 %floodtest. $+ $nick On
  alias todate {
    var %month = $1
    var %day = $$2
    var %year = $asctime(yyyy)

    var %todate = $calc($ctime($+(%day,-,%month,-,%year) 00:00:00) - $ctime)
    if (%todate < 0) {
      inc %year
      %todate = $calc($ctime($+(%day,-,%month,-,%year) 00:00:00) - $ctime)
    }
    return %todate
  }
  //echo -a $duration($todate(08,12))
}
Posted By: Nillen

Re: Help with "countdown" command. - 11/08/15 10:34 PM

Code:
  alias todate {
    var %month = $$1
    var %day = $$2
    var %year = $asctime(yyyy)

    var %todate = $calc($ctime($+(%day,-,%month,-,%year) 00:00:00) - $ctime)
    if (%todate < 0) {
      inc %year
      %todate = $calc($ctime($+(%day,-,%month,-,%year) 00:00:00) - $ctime)
    }
    return %todate
  }

on 1:TEXT:!countdown & &:#artiiz:{
   msg # There is $duration($todate($2,$3)) until $2 $3 $+ .
}
Try typing either //echo -a $duration($todate(08,12)) or as another user !countdown 08 12
Posted By: Artiiz

Re: Help with "countdown" command. - 12/08/15 12:30 AM

Originally Posted By: Nillen
Code:
  alias todate {
    var %month = $$1
    var %day = $$2
    var %year = $asctime(yyyy)

    var %todate = $calc($ctime($+(%day,-,%month,-,%year) 00:00:00) - $ctime)
    if (%todate < 0) {
      inc %year
      %todate = $calc($ctime($+(%day,-,%month,-,%year) 00:00:00) - $ctime)
    }
    return %todate
  }

on 1:TEXT:!countdown & &:#artiiz:{
   msg # There is $duration($todate($2,$3)) until $2 $3 $+ .
}
Try typing either //echo -a $duration($todate(08,12)) or as another user !countdown 08 12


I made it work now smile
Just one more question, is it possible to make an exact time for the code to count down for? So that the hours, minutes and seconds becomes exactly.
Posted By: Nillen

Re: Help with "countdown" command. - 12/08/15 12:33 AM

Very possible, I didn't design the code and I have no plans on editing it though.
It looks more like a logical question than a scripting question. You have the value set to 00:00:00 in the script, I guess just change that dynamically and it's all set.
Posted By: Artiiz

Re: Help with "countdown" command. - 12/08/15 12:46 AM

I managed to make it with exact time also.

I really appreciate all the help laugh <3
© 2020 mIRC Discussion Forums