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
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 } ```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
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.
Jethro thats what i did and got the same
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
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.
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