B+B
Posted by unkNown
Wednesday, November 02, 2005
Description: Birthday info and pregnancy info

This script will tell you how long you have been alive in seconds, minutes, hours, days, and weeks, which isn't uncommon.  However this script displays it in real-time in a dialog box as well as generating your estimated conception date based on a 40 week pregnancy.  You can msg or echo the info to any active window also.  There is a different message on the day of your birthday when using the msg or echo function.

If you are or know someone who is pregnant, you can generate how far along the mother is and when the due date is using the /baby alias which can also be msg'd or echo'd to the active window.

I know this is a wierd script, and no one will probably like it - but it came out of necessity so here it is!

SCREENSHOT: http://unknown.staticservers.com/mirc/bday.gif

; B+B (Birthday and Baby)
;
;           by unkNown
;     unknown@staticservers.com
; #staticservers | #counter-strike on GameSurge.net IRC
;
; This script was written due to the fact that my wife is now pregnant!
;   I wanted to keep tabs on how far along she was and when the due date is
;   based on a 40 week pregnancy.  It then turned into much more adding the
;   birthday life counter and conception date generator.  
;
; '/bday' opens up the birthday dialog and real-time life counter.
; '/bday msg' will send your birthday info to the active window as a msg.
; '/bday echo' will send your birthday info to the active window as an echo.
;
; '/baby' opens up the real-time baby dialog.
; '/baby msg' will send the baby info to the active window as a msg.
; '/baby echo' will send the baby info to the active window as an echo.

dialog baby {
  size 300 200 270 330
  title "Baby Countdown"
  text "Seconds:", 1, 20 20 130 15
  edit $calc($ctime - $ctime($baby.lastperiod)), 2, 150 18 100 20, disable
  text "Minutes:", 3, 20 45 110 15
  edit $calc(($ctime - $ctime($baby.lastperiod)) /60), 4, 150 43 100 20, disable
  text "Hours:", 5, 20 70 110 15
  edit $calc(($ctime - $ctime($baby.lastperiod)) /60 /60), 6, 150 68 100 20, disable
  text "Days:", 7, 20 95 110 15
  edit $calc(($ctime - $ctime($baby.lastperiod)) /60 /60 /24), 8, 150 93 100 20, disable
  text "Seconds:", 9, 20 170 110 15
  edit $calc($ctime($baby.duedate) - $ctime), 10, 150 168 100 20, disable
  edit $duration($calc($ctime - $ctime($baby.lastperiod))), 11, 35 117 200 20, disable center
  text "Minutes:", 12, 20 195 110 15
  edit $calc(($ctime($baby.duedate) - $ctime) /60), 13, 150 193 100 20, disable
  text "Hours:", 14, 20 220 110 15
  edit $calc(($ctime($baby.duedate) - $ctime) /60 /60), 15, 150 218 100 20, disable
  text "Days:", 16, 20 245 110 15
  edit $calc(($ctime($baby.duedate) - $ctime) /60 /60 /24), 17, 150 243 100 20, disable
  edit $duration($calc($ctime($baby.duedate) - $ctime)), 18, 35 267 200 20, disable center
  check "Save conception date", 19, 10 300 100 20
  box $baby.duedate(title), 97, 2 150 266 145
  box $baby.lastperiod(title), 98, 2 0 266 145
  button "Close", 99, 195 300 70 25, ok
}
dialog baby.alert {
  size 250 350 400 100
  title "Alert"
  text %baby.alertmsg, 70, 50 35 300 30, center
  button "OK", 71, 150 75 100 20, ok
}
dialog baby.date {
  size -1 -1 400 100
  title "Date of Mothers last period"
  text "Please select the date of the Mothers last period:", 1, 40 10 300 15
  combo 2, 75 40 100 20, drop
  combo 3, 190 40 40 20, drop
  combo 4, 250 40 70 20, drop
  button "OK", 99, 150 75 100 20, ok
}
dialog baby.birthday {
  size -1 -1 400 100
  title "Date of Birthday"
  text "Please select the date of birth:", 1, 40 10 300 15
  combo 2, 75 40 100 20, drop
  combo 3, 190 40 40 20, drop
  combo 4, 250 40 70 20, drop
  button "OK", 99, 150 75 100 20, ok
}
dialog baby.bday {
  size 300 200 270 330
  title "Birthday Information"
  text "Seconds:", 1, 20 20 130 15
  edit "", 2, 150 18 100 20, disable
  text "Minutes:", 3, 20 45 110 15
  edit "", 4, 150 43 100 20, disable
  text "Hours:", 5, 20 70 110 15
  edit "", 6, 150 68 100 20, disable
  text "Days:", 7, 20 95 110 15
  edit "", 8, 150 93 100 20, disable
  text "Early Conception Date:", 9, 20 170 200 15
  edit "", 10, 150 168 100 20, disable
  edit "", 11, 35 117 200 20, disable center
  text "Late Conception Date:", 12, 20 195 110 15
  edit "", 13, 150 193 100 20, disable
  text "Approx age:", 14, 20 220 110 15
  edit "", 15, 150 218 100 20, disable
  text "Next Birthday in (days):", 16, 20 245 150 15
  edit "", 17, 150 243 100 20, disable
  edit "", 18, 35 267 200 20, disable center
  check "Save birthdate", 19, 10 300 100 20
  box $baby.bday(title), 97, 2 150 266 145
  box "Life Counter", 98, 2 0 266 145
  button "Close", 99, 195 300 70 25, ok
}

on 1:dialog:baby:init:0: { did -f baby 99 | if (%baby.lastperiod != $null) { did -c baby 19 } }
on 1:dialog:baby.bday:init:0: { did -f baby.bday 99 | if (%baby.birthday != $null) { did -c baby.bday 19 } }
on 1:dialog:baby:sclick:*: {
  if ($did == 99) {
    if ($did(19).state == 1) { .timerbabynum off }
    if ($did(19).state == 0) { .timerbabynum off | unset %baby.lastperiod | unset %baby.command }
  }
}
on 1:dialog:baby.bday:sclick:*: {
  if ($did == 99) {
    if ($did(19).state == 1) { .timerbabynum2 off }
    if ($did(19).state == 0) { .timerbabynum2 off | unset %baby.bday* | unset %baby.birth* }
  }
}

on 1:dialog:baby:close:*: { .timerbabynum off }
on 1:dialog:baby.date:sclick:*: {  
  if ($did == 99) {
    if ($did(baby.date,4).seltext == $null) { openbabya You must first select a year. | halt }
    if ($did(baby.date,3).seltext == $null) { openbabya You must first select a day. | halt }
    if ($did(baby.date,2).seltext == $null) { openbabya You must first select a month. | halt }
    set %baby.lastperiod $did(baby.date,4).seltext $did(baby.date,2).seltext $did(baby.date,3).seltext
  }
}
on 1:dialog:baby.date:init:0: {
  var %i 1 | while ($asctime($calc(31561200 - (2614232 * %i)),mmmm) != $null) { did -a baby.date 2 $asctime($calc(31561200 - (2614232 * %i)),mmmm) | inc %i }
  var %ii 1 | while (%ii <= 31) { did -a baby.date 3 %ii | inc %ii }
  var %iii 1978 | while (%iii <= 2008) { did -a baby.date 4 %iii | inc %iii }
}
on 1:dialog:baby.birthday:init:0: {
  var %i 1 | while ($asctime($calc(31561200 - (2614232 * %i)),mmmm) != $null) { did -a baby.birthday 2 $asctime($calc(31561200 - (2614232 * %i)),mmmm) | inc %i }
  var %ii 1 | while (%ii <= 31) { did -a baby.birthday 3 %ii | inc %ii }
  var %iii 1978 | while (%iii <= 2008) { did -a baby.birthday 4 %iii | inc %iii }
}
on 1:dialog:baby.birthday:sclick:*: {  
  if ($did == 99) {
    if ($did(baby.birthday,4).seltext == $null) { openbabya You must first select a year. | halt }
    if ($did(baby.birthday,3).seltext == $null) { openbabya You must first select a day. | halt }
    if ($did(baby.birthday,2).seltext == $null) { openbabya You must first select a month. | halt }
    set %baby.birthday $did(baby.birthday,4).seltext $did(baby.birthday,2).seltext $did(baby.birthday,3).seltext
    set %baby.birthday.next $ceil($calc($did(baby.birthday,4).seltext + $calc(($ctime - $ctime($baby.bday) - 500000) /60 /60 /24 /365))) $did(baby.birthday,2).seltext $did(baby.birthday,3).seltext
    set %baby.birthday.msg $did(baby.birthday,2).seltext $did(baby.birthday,3).seltext $did(baby.birthday,4).seltext
    set %baby.birthday.this $ceil($calc(($did(baby.birthday,4).seltext -1 ) + $calc(($ctime - $ctime($baby.bday) - 500000) /60 /60 /24 /365))) $did(baby.birthday,2).seltext $did(baby.birthday,3).seltext

  }
}
on 1:dialog:baby.bday:close:*: { .timerbabynum2 off }
on 1:dialog:baby.date:close:*: { if (%baby.lastperiod != $null) { baby2 %baby.command | unset %baby.command } | unset %baby.command | halt }
on 1:dialog:baby.birthday:close:*: { if (%baby.birthday != $null) { bday2 %baby.bday.command | unset %baby.bday.command } | unset %baby.bday.command | halt }
alias baby.lastperiod { if ($1 == title) { return Time since conception - %baby.lastperiod } | return %baby.lastperiod 00:00:00 }
alias baby.duedate {
  if ($1 == title) { return Time until due date - $asctime($calc($ctime($baby.lastperiod) + 24192000),dddd mmmm dd yyyy) }
  if ($1 == text) { return $asctime($calc($ctime($baby.lastperiod) + 24192000),dddd mmmm dd yyyy) }
  return $asctime($calc($ctime($baby.lastperiod) + 24192000),yyyy mmmm dd) 00:00:00
}
alias baby.bday {
  if ($1 == title) { return Birthday - %baby.birthday }
  if ($1 == next) { return %baby.birthday.next 00:00:00 }
  if ($1 == msg) { return %baby.birthday.msg }
  return %baby.birthday 00:00:00
}
alias baby.conception {
  if ($1 == title) { return Estimated date of Conception - $asctime($calc(($ctime - $ctime($baby.bday)) - 24192000), dddd mmmm dd yyyy) }
  if ($1 == text) { return $asctime($calc(($ctime - $ctime($baby.bday)) - 24192000), dddd mmmm dd yyyy) }
  return $asctime($calc(($ctime - $ctime($baby.bday)) - 24192000), yyyy mmmm dd)
}
alias baby.update {
  did -o baby 2 1 $calc($ctime - $ctime($baby.lastperiod))
  did -o baby 4 1 $calc(($ctime - $ctime($baby.lastperiod)) /60)
  did -o baby 6 1 $calc(($ctime - $ctime($baby.lastperiod)) /60 /60)
  did -o baby 8 1 $calc(($ctime - $ctime($baby.lastperiod)) /60 /60 /24)
  did -o baby 10 1 $calc($ctime($baby.duedate) - $ctime)
  did -o baby 11 1 $duration($calc($ctime - $ctime($baby.lastperiod)))
  did -o baby 13 1 $calc(($ctime($baby.duedate) - $ctime) /60)
  did -o baby 15 1 $calc(($ctime($baby.duedate) - $ctime) /60 /60)
  did -o baby 17 1 $calc(($ctime($baby.duedate) - $ctime) /60 /60 /24)
  did -o baby 18 1 $duration($calc($ctime($baby.duedate) - $ctime))
}
alias baby.bday.update {
  did -o baby.bday 2 1 $calc($ctime - $ctime($baby.bday))
  did -o baby.bday 4 1 $calc(($ctime - $ctime($baby.bday)) /60)
  did -o baby.bday 6 1 $calc(($ctime - $ctime($baby.bday)) /60 /60)
  did -o baby.bday 8 1 $calc(($ctime - $ctime($baby.bday)) /60 /60 /24)
  did -o baby.bday 10 1 $asctime($calc(($ctime($baby.bday) - 24192000) + 604800), mm/dd/yy)
  did -o baby.bday 11 1 $duration($calc($ctime - $ctime($baby.bday)))
  did -o baby.bday 13 1 $asctime($calc(((($ctime($baby.bday) - 24192000) + 604800) + 604800) + 604800), mm/dd/yy)
  did -o baby.bday 15 1 $calc((($ctime - $ctime($baby.bday) - 500000)) /60 /60 /24 /365)
  did -o baby.bday 17 1 $calc(($ctime($baby.bday(next)) - $ctime) /60 /60 /24)
  did -o baby.bday 18 1 $duration($calc($ctime($baby.bday(next)) - $ctime))
}
alias baby {
  if (%baby.lastperiod == $null) { openbabyd baby.date | set %baby.command $1- | halt }
  baby2 $1-
}
alias baby2 {
  if ($1 == $null) { openbabyd baby | .timerbabynum 0 1 baby.update | halt }
  set %baby.msg $1-
  if ($1 == msg) { set %baby.msg msg $active }
  if ($1 == echo) { set %baby.msg echo -a }
  %baby.msg My unborn baby is $calc($ctime - $ctime($baby.lastperiod)) seconds old ( $+ $calc(($ctime - $ctime($baby.lastperiod)) /60 /60 /24) days) ( $+ $duration($calc($ctime - $ctime($baby.lastperiod))) $+ ).  His/Her due date is in $duration($calc($ctime($asctime($calc($ctime($baby.lastperiod) + 24192000),yyyy mmmm dd)) - $ctime)) ( $+ $baby.duedate(text) $+ ).
  unset %baby.msg
}
alias bday {
  if ($calc(($ctime($baby.bday(next)) - $ctime) /60 /60 /24) <= 0) { unset %baby.birth* | unset %baby.bday | openbabyd baby.birthday | set %baby.bday.command $1- | halt }
  if (%baby.birthday == $null) { openbabyd baby.birthday | set %baby.bday.command $1- | halt }
  bday2 $1-
}
alias bday2 {
  if ($1 == $null) { openbabyd baby.bday | .timerbabynum2 0 1 baby.bday.update | halt }
  set %baby.bday.msg $1-
  if ($1 == msg) { set %baby.bday.msg msg $active }
  if ($1 == echo) { set %baby.bday.msg echo -a }
  if ($ctime($asctime(yyyy mmmm dd)) == $ctime(%baby.birthday.this)) { %baby.bday.msg I am $calc($ctime - $ctime($baby.bday)) seconds old ( $+ $calc((($ctime - $ctime($baby.bday) - 500000)) /60 /60 /24 /365) years $+ ).  My birthday is [^B][^U]today[^B][^U] and I was conceived between $asctime($calc(($ctime($baby.bday) - 24192000) + 604800), mm/dd/yy) and $asctime($calc(((($ctime($baby.bday) - 24192000) + 604800) + 604800) + 604800), mm/dd/yy) $+ .  My next birthday is in $duration($calc($ctime($baby.bday(next)) - $ctime)) ( $+ $calc(($ctime($baby.bday(next)) - $ctime) /60 /60 /24) days). | unset %baby.bday.msg | halt }
  %baby.bday.msg I am $calc($ctime - $ctime($baby.bday)) seconds old ( $+ $calc((($ctime - $ctime($baby.bday) - 500000)) /60 /60 /24 /365) years $+ ).  My birthday is $baby.bday(msg) and I was conceived between $asctime($calc(($ctime($baby.bday) - 24192000) + 604800), mm/dd/yy) and $asctime($calc(((($ctime($baby.bday) - 24192000) + 604800) + 604800) + 604800), mm/dd/yy) $+ .  My next birthday is in $duration($calc($ctime($baby.bday(next)) - $ctime)) ( $+ $calc(($ctime($baby.bday(next)) - $ctime) /60 /60 /24) days).  
  unset %baby.bday.msg
}
alias openbabyd { $iif($dialog($1),dialog -v $1 $1,dialog -md $1 $1) }
alias openbabya { set %baby.alertmsg $1- | openbabyd baby.alert }
menu menubar {
  B+B
  .Birthday Info:bday
  .Baby Info:baby
}


Submit a comment
Oops! You need to login or register before you can post a comment!

ebaum's world