When you load this script allow it to initialize because it will
ask you for your Date of Birth and save it as a variable.
The basic command is:
/age (day/month/year)
If you use "/age" on it's own, it will say how old you are based
on the DOB you gave on initialization. To change your DOB use:
/age.setdob day/month/year
Using "/age day/month/year" will say how old that DOB is today.
Enjoy =)
on *:load:{ set %dob $$?="Please enter your Date of Birth in this format: day/month/year. $crlf $+ (i.e 14/3/83)" }
alias age {
if ( $1 != $null ) {
age.calc $duration($calc($ctime - $ctime($1)))
msg $active You are %age.years years $+ , %age.weeks weeks $+ , and %age.days old.
}
else {
age.calc $duration($calc($ctime - $ctime(%dob)))
msg $active I am %age.years years $+ , $calc(%age.weeks - 3 ) weeks $+ , and %age.days old! }
unset %age.* }
alias age.calc {
set %age.rawweeks $remove($$1,wks)
set %age.days $2
set %age.weeks $calc(%age.rawweeks % 52)
set %age.years $calc((%age.rawweeks - %age.weeks) / 52)
}
alias age.setdob { set %dob $$?="Please enter your Date of Birth in this format: day/month/year. $crlf $+ (i.e 14/3/83)" }