age.mrc - Calculate Your Age

;;;; My Age v1.1.0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Written by:                                                                ;;
;;   Brian Schmidt aka. brianMan.                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Readme / Help ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Load this script in mIRC, if you don't know how to do this, then perhaps   ;;
;; you shouldn't be using this script.                                        ;;
;;                                                                            ;;
;; Simple script to tell how old you are in seconds, or minutes etc.          ;;
;;                                                                            ;;
;; Commands available:                                                        ;;
;;   /myage                                                                   ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Changelog ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; v1.1.0                                                                     ;;
;; + Added possibility to only say your age in one format (hour/sec etc.).    ;;
;; * Changed the actual trigger alias from /age to /myage. The age alias is   ;;
;;   only used as an identifier that returns the value to the calling script. ;;
;; + Will now ask for your birthdate when run, if it isn't set. Then store it ;;
;;   in a variable for later use.
;;                                                                            ;;
;; v1.0.0                                                                     ;;
;; + Initial release.                                                         ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

alias age {
  var %unix = $ctime($$1-)
  var %now = $ctime
 var %seconds = $calc( %now - %unix )
  var %minutes = $calc( %seconds / 60 )
  var %hours = $calc( %minutes / 60 )
  var %days = $calc( %hours / 24 )
  var %weeks = $calc( %days / 7 )
  var %years = $calc( %days / 365.22222222222 )
  var %months = $calc( %years * 12 )

  if ($prop == seconds) return %seconds
 elseif ($prop == minutes) return %minutes
 elseif ($prop == hours) return %hours
 elseif ($prop == days) return %days
 elseif ($prop == weeks) return %weeks
 elseif ($prop == months) return %months
 elseif ($prop == years) return %years
 else return %years
}

alias
myage {
  if (%myage.birthday == $null || $1 == set) {
    set %myage.birthday $$input(What is your birth date? $+ $crlf $+ Example: $+ $crlf 13.12.1976 23:59:59,e,Birth date?)
  }
  if ($1 == sec) msg $active I am $age(%myage.birthday).seconds seconds old.
  elseif ($1 == min || $1 == minute || $1 == minutes) msg $active I am $age(%myage.birthday).minutes minutes old.
  elseif ($1 == hrs || $1 == hour || $1 == hours) msg $active I am $age(%myage.birthday).hours hours old.
  elseif ($1 == day || $1 == days) msg $active I am $age(%myage.birthday).days days old.
  elseif ($1 == wek || $1 == week || $1 == weeks) msg $active I am $age(%myage.birthday).weeks weeks old.
  elseif ($1 == mth || $1 == month || $1 == months) msg $active I am $age(%myage.birthday).months months old.
  elseif ($1 == yrs || $1 == year || $1 == years) msg $active I am $age(%myage.birthday).years years old.
  else msg $active My age in: Seconds: $age(%myage.birthday).seconds $+ . Minutes: $age(%myage.birthday).minutes $+ . Hours: $age(%myage.birthday).hours $+ . Days: $age(%myage.birthday).days $+ . Weeks: $age(%myage.birthday).weeks $+ . Months: $age(%myage.birthday).months $+ . Years: $age(%myage.birthday).years $+ .
}

Leave a comment