OBS Quote System

By anthonydfurr on Feb 18, 2014

Simple yet functional dialog quote system. Comes with a snarky messaging system :) Must have a quotes.txt file loaded to your mIRC directory.

To open the OBS Quote System, simply type /qSystem

;****************************************
;                                       *
;         OBS QUOTE SYSTEM v1.0         *
;                                       *
;****************************************
;********************
;      DIALOG       *
;********************

dialog Quote {
  title "OBS Quote System"
  size 5 5 500 270
  box "Loaded Quotes"1,5 5 410 207
  list 2,10 20 400 205, Hsbar
  button "Exit"3,420 220 75 20,OK
  edit ""4,45 220 370 20, Autohs
  text "Quote:"5,5 225 35 20
  button "Add"6, 45 245 50 20
  button "Delete"7, 420 70 75 20
  button "Message"8, 420 20 75 20
  button "Echo"9, 420 45 75 20
  button "Clear"10, 100 245 50 20
  button "Refresh"11, 420 95 75 20
  button "QOTD"12, 420 120 75 20
  text "Creator: anthonydfurr © 2014"13,345 250 155 20
}

;********************
;     ALIASES       *
;********************

alias qSystem {
  dialog -m quote quote
}

alias Add {
  var %quote = $did(4).text
  write quotes.txt %quote
  msg $active $talker(OBS Quote System) $talker(Added Quote: %quote) $talker(Index: $LineCount)
  LoadQuotes
}

alias Delete {
  var %quote = $did(2).seltext
  var %index = $did(2).sel
  write $+(-dl,%index) quotes.txt
  msg $active $talker(OBS Quote System) $talker(Deleted Quote: %quote) $talker(Index: %index)
  LoadQuotes
}

alias Refresh {
  dialog -x quote quote
  dialog -md quote quote
}

alias LineCount {
  return $lines(quotes.txt)
}

alias QOTD {
  if ($LineCount > 0) {
    var %QOTD = $read(quotes.txt)
    msg $active $talker(OBS Quote System) $talker(Quote of the Day) $talker(%QOTD)
  }
  else {
    echo -a $talker(There are currently no quotes saved.)
  }
}

alias LoadQuotes {
  if ($findfile($mircdir,*quotes.txt,1)) {
    var %count = 1
    did -r quote 2
    while (%count <= $LineCount) {
      did -a quote 2 $read(quotes.txt,%count)
      inc %count
    }
  }
  else {
    echo -a $talker(Error: No quotes were loaded. Please load a .txt file in to your mIRC directory named quotes.txt.)
  }
}

alias talker { 
  var %left = 01[
  var %right = 01]
  var %color1 = 04
  var %color2 = 14
  var %i = 1
  while (%i <= $gettok($1-,0,32)) {
    var %msg = %msg  $+(%color1,$upper($left($gettok($1-,%i,32),1)),%color2,$lower($right($gettok($1-,%i,32),-1)))
    inc %i
  }
  return $+(%left,%msg,%right)
}

;*********************
;     ON DIALOG      *
;*********************

on *:DIALOG:quote:*:*:{
  if ($devent == init) {
    loadQuotes
  }
  if ($devent == sclick) {
    if ($did == 2) {
      did -r quote 4
      did -a quote 4 $did(2).seltext
    }
    if ($did == 6) {
      if ($did(4).text) {
        Add
      }
      else {
        echo -a $talker(Error: There wasn't a quote typed in to the edit box. Please try again.)
      }
    }
    if ($did == 7) {
      if ($did(2).seltext) {
        Delete
      }
      else {
        echo -a $talker(OBS Quote System) $talker(Error: Please select a quote from the list to delete.)
      }
    }
    if ($did == 8) {
      if ($did(2).seltext) {
        msg $active $talker(OBS Quote System) $talker(Quote Selector) $talker(Quote: $did(2).seltext)
      }
      else {
        echo -a $talker(Please select a quote to message from the list.)
      }
    }
    if ($did == 9) {
      if ($did(2).seltext) {
        echo -a $talker(OBS Quote System) $talker(Quote Selector) $talker(Quote: $did(2).seltext)
      }
      else {
        echo -a $talker(Please select a quote to echo from the list.)
      }
    }
    if ($did == 10) {
      did -r quote 4
    }
    if ($did == 11) {
      Refresh
    }
    if ($did == 12) {
      QOTD
    }
  }
}

Comments

Sign in to comment.
anthonydfurr   -  Feb 19, 2014

I need feedback! This is my first mIRC script. How does it look? does it work properly? How is my scripting conventions? How can I improve this?

brenna  -  Jul 09, 2015

is there a way to remove the colors from the text or change them? in the channel i call home the colors are offensive but i love the script thank you

Sign in to comment

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.