Mother Says 1.1

By IllogicTC on Apr 02, 2011

Mother Says is a concept I developed after remembering the good ol' days of the "Mama Says" tidbit on YahElite.

Use /mothersays to open. Once open, you have a heap of options to choose from, and you can make Mother either tell you a message, open a program/file for you, or close your mIRC. You can set the timer to either be in X minutes or at X time, and have the ability to make Mother warn you X minutes beforehand, and give you a couple of ten-minute extensions if you are not quite done.

*Note: Yes, I know people are going to type gibberish in the editboxes to break it and comment that I need to add more code to filter that junk out. I don't find this necessary with how straightforward the design is, so please don't comment on that bit. However, if you find other ways to break it please DO let me know ^_^

alias mothersays {
  dialog -m mother_says_setup mother_says_setup
}

dialog mother_says_setup {
  title "Mother Says... Set Up Your Nag!"
  size -1 -1 132 98
  option dbu
  box "Type", 1, 2 2 57 42
  radio "Message", 2, 5 10 34 10, group
  radio "Shut down mIRC", 3, 5 21 51 10
  radio "Run Program...", 4, 5 32 50 10
  box "Timer Type", 5, 61 2 69 42
  radio "In X Minutes...", 6, 64 10 51 10, group
  radio "At X Time...", 7, 64 21 50 10
  edit "", 8, 71 32 49 10
  box "Other Options", 9, 2 45 128 50
  text "Message/Program:", 10, 4 54 46 8
  edit "", 11, 51 53 77 10, autohs
  radio "Allow Time Extension", 12, 4 75 63 10, group
  radio "No Time Extension", 13, 4 84 62 10
  check "Give", 14, 4 64 21 10
  button "Start", 16, 83 69 44 23, ok
  edit "10", 15, 25 64 14 10
  text "Minute Warning", 17, 40 66 39 7
}

dialog mother_says_message {
  title "Mother Says..."
  size -1 -1 131 71
  option dbu
  text "", 1, 2 3 127 50
  button "OK", 2, 2 55 127 12, ok
}

dialog mother_says_run {
  title "Mother Says..."
  size -1 -1 131 47
  option dbu
  button "OK", 2, 2 33 40 12, ok
  text "Oh my, look at the time! You really ought to open that program of yours. Here, let me get it for you.", 1, 2 2 127 28
  button "Gimme Time...", 3, 45 33 41 12, ok
  button "Cancel", 4, 89 33 40 12, ok
}

dialog mother_says_off {
  title "Mother Says..."
  size -1 -1 131 37
  option dbu
  button "OK", 2, 2 22 40 12, ok
  text "Oh my, it is time for you to get off that Chat Program! It'll rot your brain if you sit there so long!", 1, 2 2 127 19
  button "Gimme Time...", 3, 45 22 41 12, ok
  button "Cancel", 4, 89 22 40 12, ok
}

on *:dialog:mother_says_setup:*:*: {
  if ($devent == init) did -c $dname 2,6,12,14
  if ($devent == sclick) {
    if ($did == 2) did -e $dname 11
    if ($did == 4) {
      did -e $dname 11
      var %x $sfile(C:,What would you like to run?)
      did -ra $dname 11 %x
    }
    elseif ($did == 3) did -b $dname 11
    elseif ($did == 14) {
      if ($did($dname,14).state == 0) did -rb $dname 15
      else did -ae $dname 15 10
    }
    elseif ($did == 16) {
      if ($did($dname,2).state == 1) {
        set %momsay_type Message
        set %momsay_data $did($dname,11)
      }
      elseif ($did($dname,3).state == 1) set %momsay_type Close
      elseif ($did($dname,4).state == 1) {
        set %momsay_type Run
        set %momsay_data $did($dname,11)
      }
      if ($did($dname,6).state == 1) {
        .timermomsays 1 $calc($did($dname,8) * 60) do_as_mom_says
        if ($did($dname,14).state == 1) {
          set %momsays_warn $did($dname,15)
          .timermomwarn 1 $calc(($did($dname,8) - $did($dname,15)) * 60) mom_warn
        }
      }
      elseif ($did($dname,7).state == 1) {
        .timermomsays $did($dname,8) 1 1 do_as_mom_says
        if ($did($dname,14).state == 1) {
          set %momsays_warn $did($dname,15)
          var %b $did($dname,8)
          var %c $calc((($gettok(%b,1,58) * 60) + $gettok(%b,2,58)) - $did($dname,15))
          var %d $int($calc(%c / 60))
          %c = $calc(%c - (%d * 60))
          %c = $+(%d,$chr(58),%c)
          .timermomwarn %c 1 1 mom_warn
        }
      }
      if ($did($dname,12).state == 1) set %momsay_extension 2
      else set %momsay_extension 0
    }
  }
}

on *:dialog:mother_says_message:init:*: did -a $dname 1 %momsay_data

on *:dialog:mother_says_run:*:*: {
  if ($devent == init) {
    if (%momsay_extension == 0) {
      did -b $dname 3
      did -b $dname 4
    }
  }
  if ($devent == sclick) {
    if ($did == 2) {
      run %momsay_data
      unset %momsay_*
      dialog -x mother_says_run
    }
    if ($did == 3) {
      noop $input(You have ten minutes!,o)
      .timermomex 1 600 do_as_mom_says
      dec %momsay_extension
      dialog -x mother_says_run
    }
    if ($did == 4) dialog -x mother_says_run
  }
}

on *:dialog:mother_says_off:*:*: {
  if ($devent == init) {
    if (%momsay_extension == 0) {
      did -b $dname 3
      did -b $dname 4
    }
  }
  if ($devent == sclick) {
    if ($did == 2) {
      unset %momsay_*
      exit -n
      dialog -x mother_says_off
    }
    if ($did == 3) {
      noop $input(You have ten minutes!,o)
      .timermomex 1 600 do_as_mom_says
      dec %momsay_extension
      dialog -x mother_says_off
    }
    if ($did == 4) dialog -x mother_says_off
  }
}

alias mom_warn {
  var %x $input(Mother Says: You have %momsays_warn minutes left! Keep timer going?,yv)
  if (%x == $no) .timermomsays off
}

alias do_as_mom_says {
  if (%momsay_type == Message) dialog -m mother_says_message mother_says_message
  if (%momsay_type == Run) dialog -m mother_says_run mother_says_run
  if (%momsay_type == close) dialog -m mother_says_off mother_says_off
}

Comments

Sign in to comment.
IllogicTC   -  Apr 03, 2011

I did look at $input(), however Yes/No/Cancel buttons didn't seem appropriate for their appropriate responses. That, and $input() in aliases always seems to give trouble. I originally DID have them though =P. Thanks for the suggestion, though! Also, now that you mentioned that I better go make a PM blocker and a Youtube URL thing. jk :P

Also, update:

  • Now when selecting "Run Program..." an $sfile() box will appear to make it easier for people to find what they want opened. If you want to type it in yourself, just click cancel when the box appears.
 Respond  
T1   -  Apr 03, 2011

I like it and you know why ;)

Thanks a lot for it~

 Respond  
Sorasyn   -  Apr 02, 2011

I noticed some of your warning dialogs are fairly small. It might be worth investigating $input() to shorten your code immensely. Although $input() can be short sighted when it comes to button events and such so it may be that it doesn't fit the bill at all; if this is the case simply ignore my suggestion. Looks great otherwise. Nice to see a little variety in snippets submissions lately.

 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.