mIRC Home    About    Download    Register    News    Help

Print Thread
Help with "countdown" command. #254279 31/07/15 09:18 PM
Joined: Apr 2015
Posts: 42
A
Artiiz Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Apr 2015
Posts: 42
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!

Re: Help with "countdown" command. [Re: Artiiz] #254281 31/07/15 09:33 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
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.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: Help with "countdown" command. [Re: Nillen] #254285 31/07/15 09:47 PM
Joined: Apr 2015
Posts: 42
A
Artiiz Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Apr 2015
Posts: 42
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

Re: Help with "countdown" command. [Re: Artiiz] #254354 06/08/15 01:17 PM
Joined: Apr 2015
Posts: 42
A
Artiiz Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Apr 2015
Posts: 42
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.

Re: Help with "countdown" command. [Re: Artiiz] #254355 06/08/15 01:34 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
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.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: Help with "countdown" command. [Re: Nillen] #254457 11/08/15 06:17 PM
Joined: Apr 2015
Posts: 42
A
Artiiz Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Apr 2015
Posts: 42
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))
}

Re: Help with "countdown" command. [Re: Artiiz] #254464 11/08/15 10:34 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
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


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: Help with "countdown" command. [Re: Nillen] #254465 12/08/15 12:30 AM
Joined: Apr 2015
Posts: 42
A
Artiiz Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Apr 2015
Posts: 42
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.

Re: Help with "countdown" command. [Re: Artiiz] #254466 12/08/15 12:33 AM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
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.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: Help with "countdown" command. [Re: Nillen] #254467 12/08/15 12:46 AM
Joined: Apr 2015
Posts: 42
A
Artiiz Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Apr 2015
Posts: 42
I managed to make it with exact time also.

I really appreciate all the help laugh <3