Show age and time until birthday

By pball on Oct 11, 2011

This little piece of code shows off your age and time until your next birthday.

How to use:
Replace "Oct 11 1887 10:00:00" with your birth date. Day, month, and year required. If no time is given it will default to 00:00:00 which is the beginning of the day. This only needs to be replaced in 1 place which sets this apart from other age/birthday scripts I've seen.

All of these are valid date formats I know that work, depending on how you like to show dates.
11/10/1887 10:00:00
11-10-1887 10:00:00
oct 11 1887 10:00:00
october 11 1887 10:00:00

Output is as follows.
as an action

  • pball is 1318309852 seconds old which is 41.775611 years, in 8hrs 49mins 8secs pball will be 42 on oct 11 2011 10:00:00

or as normal text

I am 1318309852 seconds old which is 41.775611 years, in 8hrs 49mins 8secs pball will be 42 on oct 11 2011 10:00:00 This snippet requires mirc 6.17 or higher, older versions will not work properly. Also this script will not work for birthdays before Jan 1 1970, this is due to $ctime which starts at that date. ```mirc ;displayed as action age { set -l %b Oct 11 1887 10:00:00 | set -l %secs $calc($ctime - $ctime(%b $iif($regex(%b,\d\d:\d\d:\d\d),,00:00:00))) | set -l %years $calc(%secs /31556926) | set -l %nb $regsubex(%b,\d\d\d\d,$calc($date(yyyy) $iif($floor(%years) = $calc($date(yyyy) - $date($ctime(%b),yyyy)),+ 1,))) $iif($regex(%b,(\d\d:\d\d:\d\d)),,00:00:00) | me is %secs seconds old which is %years years, in $duration($calc($ctime(%nb) - $ctime)) $me will be $calc($int(%years) +1) on %nb } ;displayed as normal text age { set -l %b Oct 11 1887 10:00:00 | set -l %secs $calc($ctime - $ctime(%b $iif($regex(%b,\d\d:\d\d:\d\d),,00:00:00))) | set -l %years $calc(%secs /31556926) | set -l %nb $regsubex(%b,\d\d\d\d,$calc($date(yyyy) $iif($floor(%years) = $calc($date(yyyy) - $date($ctime(%b),yyyy)),+ 1,))) $iif($regex(%b,(\d\d:\d\d:\d\d)),,00:00:00) | say I am %secs seconds old which is %years years, in $duration($calc($ctime(%nb) - $ctime)) $me will be $calc($int(%years) +1) on %nb } ```

Comments

Sign in to comment.
  -  Oct 15, 2011

I moved out long long time ago not even in the same state thank you.
I do not see how I made a big deal about any thing.

 Respond  
TheWhistler   -  Oct 13, 2011

MakiMaki LOL To old use this :P
you act like its a big deal sunnyboy
1 question: are you still under mommy's and daddy's roof ??

 Respond  
  -  Oct 12, 2011

LOL To old use this :P

 Respond  
pball   -  Oct 12, 2011

TheWhistler I noticed something, this doesn't seem to work for dates before 00:00:00 GMT, January 1, 1970. Since that's the beginning of $ctime. $ctime doesn't return a value if the date is before the beginning of $ctime.

So sorry if you were born before Jan 1 1970, I'm sorry but this won't work.

 Respond  
TheWhistler   -  Oct 12, 2011

Jethro its mirc719
Kaliforni[a] is useing mirc 7.19
its no big deal if it will not work

 Respond  
pball   -  Oct 12, 2011

It's nice my snippet has gotten a lot of chat going. Kinda sad it's about the easiest part of the actual snippet, you'd know what I mean if you've tried to do anything past simple date math.

 Respond  
Jethro   -  Oct 12, 2011

You can change /action to /me if you wish. The /action is a deprecated command but still works the same as /me.

 Respond  
Jethro   -  Oct 11, 2011
alias age {
  var %b Oct 11 1887 10:00:00
  var %secs $calc($ctime - $ctime(%b $iif($regex(%b,\d\d:\d\d:\d\d),,00:00:00)))
  var %years $calc(%secs /31556926)
  var %nb $regsubex(%b,\d\d\d\d,$calc($date(yyyy) $iif($floor(%years) = $&
    $calc($date(yyyy) - $date($ctime(%b),yyyy)),+ 1,))) $iif($regex(%b,(\d\d:\d\d:\d\d)),,00:00:00)
  var %o = %secs seconds old which is %years years, in $duration($calc($ctime(%nb) - $ctime)) $&
    $me will be $calc($int(%years) +1) on %nb | if ($regex($1,/(say|action|echo)/iS)) {
    $iif($regml(1) = echo,$v1 -agt *,$v1) %o
  }
}

Usage:

/age say
/age action
/age echo
 Respond  
  -  Oct 11, 2011

Bu buuuu but I R Lazy do it for me:P

 Respond  
Jethro   -  Oct 11, 2011

You can do that, MakiMaki, and make it: If-Elseif-Else

 Respond  
  -  Oct 11, 2011

tho adding a 3rd option to echo would be cool :P

 Respond  
Jethro   -  Oct 11, 2011

You're correct, pball, but goto command has its advantages in some situational uses, despite its infamous reputation. Actually an if-then-else will do the trick, not if-then-elseif. You only have two options, so it's either A or B.

 Respond  
  -  Oct 11, 2011

MakiMaki i give YOUr script a 10/10 :)

Not My snippet, I only changed a few things, few things to make it better for my use, the real credit is to pball

 Respond  
pball   -  Oct 11, 2011

I just posted two different versions expecting people to choose one or the other. I personally just use the /me version and added the /say since others might prefer that.

Jethro thanks for pointing out the min version, I'll just add it to the description, if you don't read it then you deserve the trouble, lol.

P.S.
Jethro, gotos are usually considered a bad way of coding. I've only ever seen people give a good reason to use gotos once and that was for a specific thing in C. I'm just saying this because the first thing you posted could be done with an if elseif statement.

 Respond  
Jethro   -  Oct 11, 2011

TheWhistler, this snippet is incompatible with mIRC version BELOW 6.17. Maybe a check will help:

if ($version >= 6.17) {
.....
}
else {
; please upgrade your mIRC version
}

 Respond  
chachin   -  Oct 11, 2011

MakiMaki i give YOUr script a 10/10 :)

 Respond  
chachin   -  Oct 11, 2011

yay it works:

<~chachin> I am 754766627 seconds old which is 23.917622 years, in 4wks 2days 6hrs 36mins 13secs chachin will be 24 on Nov 11 2011 03:36:00

 Respond  
  -  Oct 11, 2011

did you paste in the alias tab or new script?
if you pasted as a new script you need to add alias before age ie alias age {
other wise that is a odd bug if you didnt do that error by mistake

 Respond  
chachin   -  Oct 11, 2011

I dont get it i do /age n or /age a and it says

ERROR > 421: Unknown command: AGE

I'm using the one that MakiMaki did o.o

 Respond  
  -  Oct 11, 2011

What version of mirc you using?

Stuff blah blah

 Respond  
TheWhistler   -  Oct 11, 2011

alias age { age { set -l %b FEB 28 1944 10:00:00 | set -l %secs $calc($ctime - $ctime(%b $iif($regex(%b,\d\d:\d\d:\d\d),,00:00:00))) | set -l %years $calc(%secs /31556926) | set -l %nb $regsubex(%b,\d\d\d\d,$calc($date(yyyy) $iif($floor(%years) = $calc($date(yyyy) - $date($ctime(%b),yyyy)),+ 1,))) $iif($regex(%b,(\d\d:\d\d:\d\d)),,00:00:00) | me is %secs seconds old which is %years years, in $duration($calc($ctime(%nb) - $ctime)) $me will be $calc($int(%years) +1) on %nb }

[» Tue Oct 11 | 09:40:09 pm «] * ~RedBeard is 1318383609 seconds old which is 41.777948 years, in -1318383609secs RedBeard will be 42 on 0 00:00:00

Jethro thats what i did and got the same

 Respond  
  -  Oct 11, 2011

Cool Snippet, and on Jethros pointer of making it one alias as the two would only use the first one
I did this:

age { 
  var %b Oct 11 1887 10:00:00
  var %secs $calc($ctime - $ctime(%b $iif($regex(%b,\d\d:\d\d:\d\d),,00:00:00))) 
  var %years $calc(%secs /31556926) 
  var %nb $regsubex(%b,\d\d\d\d,$calc($date(yyyy) $iif($floor(%years) = $calc($date(yyyy) - $date($ctime(%b),yyyy)),+ 1,))) $iif($regex(%b,(\d\d:\d\d:\d\d)),,00:00:00) 
  $iif($1,me is ,say I am ) %secs seconds old which is %years years, in $duration($calc($ctime(%nb) - $ctime)) $me will be $calc($int(%years) +1) on %nb
}

Changed the set to var and used a $iff so say:
/age Returns

  • .iMaki is 659507236 seconds old which is 20.89897 years, in 5wks 1day 19hrs 32mins 44secs iMaki will be 21 on Nov 17 2011 10:00:00

and

/age
<.iMaki> I am 659507256 seconds old which is 20.89897 years, in 5wks 1day 19hrs 32mins 24secs iMaki will be 21 on Nov 17 2011 10:00:00

Any who nice work.

 Respond  
Jethro   -  Oct 11, 2011

Ok, I see why that didn't work for you, TheWhistler. You didn't change the month, day and year for this bit:

Oct 11 1887

Change it to your actual birthday.

 Respond  
Jethro   -  Oct 11, 2011

I'll check it out myself.

 Respond  
TheWhistler   -  Oct 11, 2011

now just how are you to work this file, i mean what are the cmds to use ??
ok i added the alias age1 } and changed the birthday to my correct dat but it gives the wrong info
gives the 1 in the age
Kalifornia is 1318353742 seconds old which is 41.777001 years, in -1318353742secs Kalifornia will be 42 on 1 00:00:00

lol i'm way pasted 42

 Respond  
Jethro   -  Oct 11, 2011

You can combine these two aliases with two commands, such as /age a for action and /age n for normal:

age {
goto $1
:a
action text
halt
:n
normal text
}

This way you don't have to fret over having two same alias conflict.

 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.