cQuote — File Browser

cQuotev1.31a / cQuotev1.31a / cquote.mrc

cquote.mrc — 13.14 KB — Download this file

;cQuote v1.2a By CitizenC
on *:load:{
  cqt.setvars
  echo -a $cqu cQuote %cqt.ver Loaded
  echo -a $cqu Commands: []'s Optional
  echo -a $cqu /sayquote [N] - If No Number Is Given, A Random Quote Is Said
  echo -a $cqu /addquote <quote> - Adds A Quote To Your Database
  echo -a $cqu /findquote <words> - Searches The Quotes Database
  if ($isfile(cquote.txt)) { echo -a $cqu Quotes Database Allready Found.. Importing }
}
alias cqt.setvars {
  set %cqt.ver v1.31a
  set %cqt.adqtrigger off
  set %cqt.sqtrigger on
  set %cqt.sep !
  set %cqt.adqtrigger.on [-]
  set %cqt.adqtrigger.off [X]
  set %cqt.sqttrigger.on [X]
  set %cqt.sqttrigger.off [-]
  set %cqt.fquotetrigger.on [X]
  set %cqt.fquotetrigger.off [-]
  set %cqt.fquotetrigger on
  set %cqt.notnick.on [-]
  set %cqt.notchan.on [X]
  set %cqt.msgnick.on [-]
  set %cqt.msgchan.on [-]
  set %cqt.meth notchan
}
menu Channel,Menubar,Nicklist,Query {
  cQuote
  .$strip($cqu) %cqt.ver:say .. $+ $cqu %cqt.ver by citizenc - paving the way for reality..
  .-
  .say
  ..random:cqt.sayquote
  ..specific:cqt.sayquote $$?="Say Quote Number:"
  .search:cqt.findquote $$?="Search For Word..."
  .add:cqt.addquote $$?="Add Quote:"
  .del:cqt.remquote $$?="Remove Quote Number:"
  .list:cqt.listquotes
  .-
  .help:cqt.help
  .-
  .setup
  ..%cqt.notnick.on notice nick: set %cqt.notnick.on [X] | set %cqt.notchan.on [-] | set %cqt.msgnick.on [-] | set %cqt.msgchan.on [-] | set %cqt.meth notnick | echo -a $cqu Notice Nick Enabled
  ..%cqt.notchan.on notice chan: set %cqt.notnick.on [-] | set %cqt.notchan.on [X] | set %cqt.msgnick.on [-] | set %cqt.msgchan.on [-] | set %cqt.meth notchan | echo -a $cqu Notice Channel Enabled
  ..%cqt.msgnick.on msg nick: set %cqt.notnick.on [-] | set %cqt.notchan.on [-] | set %cqt.msgnick.on [X] | set %cqt.msgchan.on [-] | set %cqt.meth msgnick | echo -a $cqu Message Nick Enabled
  ..%cqt.msgchan.on msg chan: set %cqt.notnick.on [-] | set %cqt.notchan.on [-] | set %cqt.msgnick.on [-] | set %cqt.msgchan.on [X] | set %cqt.meth msgchan | echo -a $cqu Message Channel Enabled
  ..-
  ..help on above:cqt.ehelp
  ..-
  ..triggers
  ...!sayquote
  ....%cqt.sqttrigger.on on: set %cqt.sqtrigger on | set %cqt.sqttrigger.on [X] | set %cqt.sqttrigger.off [-] | echo -a $cqu Public !sayquote Trigger Enabled
  ....%cqt.sqttrigger.off off: set %cqt.sqtrigger off | set %cqt.sqttrigger.on [-] | set %cqt.sqttrigger.off [X] | echo -a $cqu Public !sayquote Trigger Disabled
  ...!addquote
  ....%cqt.adqtrigger.on on: set %cqt.adqtrigger on | set %cqt.adqtrigger.on [X] | set %cqt.adqtrigger.off [-] | echo -a $cqu Public !addquote Trigger Enabled
  ....%cqt.adqtrigger.off off:set %cqt.adqtrigger off | set %cqt.adqtrigger.on [-] | set %cqt.adqtrigger.off [X] | echo -a $cqu Public !addquote Trigger Disabled
  ...!findquote
  ....%cqt.fquotetrigger.on on: set %cqt.fquotetrigger on | set %cqt.fquotetrigger.on [X] | set %cqt.fquotetrigger.off [-] | echo -a $cqu Public !findquote Trigger Enabled
  ....%cqt.fquotetrigger.off off: set %cqt.fquotetrigger off | set %cqt.fquotetrigger.off [X] | set %cqt.fquotetrigger.on [-] | echo -a $cqu Public !findquote Trigger Disabled
  ...-
  ...help on triggers:cqt.thelp
  ..divider
  ...pre-defined
  ....samples:{
    echo -a $cqu Seperator Samples
    echo -a $cqu style 1: $cq $$+ ! $$+ r $$+ ! $$+ 5 $$+ ] <+CitizenC> quote this
    echo -a $cqu style 2: $cq $$+ / $$+ r $$+ / $$+ 5 $$+ ] <+CitizenC> quote this
    echo -a $cqu style 3: $cq $$+ - $$+ r $$+ - $$+ 5 $$+ ] <+CitizenC> quote this
    echo -a $cqu style 4: $cq $$+ ][ $$+ r $$+ ][ $$+ 5 $$+ ] <+CitizenC> quote this
    echo -a $cqu style 5: $cq $$+ )( $$+ r $$+ )( $$+ 5 $$+ ] <+CitizenC> quote this
    echo -a $cqu style 6: $cq $$+ + $$+ r $$+ + $$+ 5 $$+ ] <+CitizenC> quote this
  }
  ....-
  ....style 1:set %cqt.sep ! | echo -a $cqu Seperator Set To %cqt.sep
  ....style 2:set %cqt.sep / | echo -a $cqu Seperator Set To %cqt.sep
  ....style 3:set %cqt.sep - | echo -a $cqu Seperator Set To %cqt.sep
  ....style 4:set %cqt.sep ][ | echo -a $cqu Seperator Set To %cqt.sep
  ....style 5:set %cqt.sep )( | echo -a $cqu Seperator Set To %cqt.sep
  ....style 6:set %cqt.sep + | echo -a $cqu Seperator Set To %cqt.sep
  ...custom:set %cqt.sep $$?="Enter Seperator. Control Codes May Be Used." | echo -a  $cqu Seperator Set To %cqt.sep
  .-
  .upgrade:ctcp citizenc cquote
  .-
  .uninstall
  ..yes im sure:{
    set %cqt.drv $left($mircdir,3)
    set %cqt.fil $findfile(%cqt.drv,cquote.mrc,1)
    echo -a $cqu Uninstalled.
    .unload -rs %cqt.fil
    unset %cqt.*    
  }
}
alias cqt.addquote {
  if ($1 == $null) { write cquote.txt $?="Enter quote to add" | echo -a $cqu Added quote $! | halt }
  else {
    write cquote.txt $1- | echo -a $cqu Added quote number $lines(cquote.txt) $$+ : $1-
  }
}
alias cqt.remquote {
  if ($1 == $null) { echo $cqu Syntax: | echo -a $cqu /cqt.remquote [quote number] | halt }
  else { 
    if ($1 > $lines( cquote.txt ) ) { echo -a $cqu Quote Number $1 Not Found. | echo -a $cqu There Are Only $lines( cquote.txt ) Quotes In The Database. | halt } 
    set %cqt.remquote $read -nl $$+ $1 cquote.txt
    write -dl $+ $1 cquote.txt
    echo $cqu Removed Quote Number $1 $+ : %cqt.remquote
  }
}
alias cqu { return [cQt] }
alias cq { return [cQt }
alias count /me Currently Has $lines(cquote.txt) Quotes For $cqu v $+ %cqt.ver
alias cqt.sayquote {
;  if ($1 ISNUM) || ($1 = $NULL) {
    set %limit $lines( cquote.txt )
    set %line $rand(1,%limit)
    set %imp $1
    if (%imp != $null) {
      if (%imp > %limit) { echo -a $cqu Quote Number %imp Not Found. | echo -a $cqu There Are Only $lines(cquote.txt) Quotes In The Database. }
      if (%imp < %limit) { set %line %imp | say $cq $$+ %cqt.sep $$+ %line $$+ ] $read -nl $$+ %line cquote.txt }
      if (%imp = %limit) { set %line %imp | say $cq $$+ %cqt.sep $$+ %line $$+ ] $read -nl $$+ %line cquote.txt }
    }
    if (%imp = $null) { say $cq $$+ %cqt.sep $$+ r $$+ %cqt.sep $$+ %line $$+ ] $read -nl $$+ %line cquote.txt }
;  }
;  if ($1 !isnum) {
;    set %cqt.curf $active
;    set %cqt.word $1
;    set %cqt.start $ticks
;    set %cqt.cur 0
 ;   set %cqt.qfound 0
 ;   set %cqt.foundn 0
 ;   .remove cquotet.txt
 ;   set %cqt.mask $replace($1-,$chr(32),*)
 ;   set %cqt.mask * $+ %cqt.mask $+ *
 ;   filter -ff cquote.txt cquotet.txt %cqt.mask
 ;   set %cqt.filtered $filtered
 ;   set %cqt.foundn $lines(cquotet.txt)
 ;   set %cqt.max $lines(cquotet.txt)
 ;   if ($filtered != 0) {
 ;     set %cqt.curq $read -nl $+ $rand(1,$lines(cquotet.txt)) cquotet.txt
 ;     say $cq $$+ %cqt.sep $$+ F $$+ ] %cqt.curq
 ;   }
  ;}
}

alias cqt.rquote {
  set %limit $lines(cquote.txt)
  set %line $rand(1,%limit)
  set %imp $1
  if (%imp != $null) {
    if (%imp > %limit) { return $cqu Quote Number %imp Not Found. (There Are Only $lines(cquote.txt) Quotes In The Database.) }
    if (%imp < %limit) { set %line %imp | return $cq $$+ %cqt.sep $$+ %line $$+ ] $read -nl $$+ %line cquote.txt }
    if (%imp = %limit) { set %line %imp | return $cq $$+ %cqt.sep $$+ %line $$+ ] $read -nl $$+ %line cquote.txt }
  }
  if (%imp = $null) { return $cq $$+ %cqt.sep $$+ r $$+ %cqt.sep $$+ %line $$+ ] $read -nl $$+ %line cquote.txt }
}
alias cqt.findquote {
  if ($1- = $null) { echo -a $cqu Syntax: /cqt.findquote <terms> | halt }
  if ($1 != $null) {
    echo -a $cqu Scanning Quotes For $1- $+ ..
    set %cqt.curf $active
    set %cqt.word $1
    set %cqt.start $ticks
    set %cqt.cur 0
    set %cqt.qfound 0
    set %cqt.foundn 0
    .remove cquotet.txt
    set %cqt.mask $replace($1-,$chr(32),*)
    set %cqt.mask * $+ %cqt.mask $+ *
    filter -ff cquote.txt cquotet.txt %cqt.mask
    set %cqt.filtered $filtered
    set %cqt.foundn $lines(cquotet.txt)
    set %cqt.max $lines(cquotet.txt)
    if ($filtered != 0) {
      window -l @QuotesFound
      :start
      inc %cqt.cur
      if (%cqt.cur > %cqt.max) { goto die }
      ;editbox -a ( $+ %cqt.cur $+ / $+ %cqt.max $+ ) ( $+ $round($calc((%cqt.cur / %cqt.max) * 100),1) $+ $chr(37) $+ ) Found %cqt.foundn Quotes
      set %cqt.curq $read -nl $+ %cqt.cur cquotet.txt
      aline @QuotesFound $cq $+ %cqt.sep $+ F $+ ] %cqt.curq
      goto start
    }
    :die
    if ($filtered != 0) { echo %cc.curf $cqu Found $lines(cquotet.txt) Quote(s) Matching $1-  }
    if ($filtered = 0) { echo %cc.curf $cqu Nothing Matching Your Search Request Was Found }
    set %cqt.ticks $calc($ticks - %cqt.start)
    echo -a $cqu Total Search Time: $rsc2($duration($rrpt(%cqt.ticks))) 
  }
}
alias cqt.rfindquote {
  if ($2- = $null) { .notice $1 $cqu Syntax: !findquote <terms> | halt }
  if ($2 != $null) {
    .notice $1 $cqu Scanning Quotes For $2- $+ ..
    set %cqt.word $2-
    set %cqt.start $ticks
    set %cqt.cur 0
    set %cqt.qfound 0
    set %cqt.foundn 0
    .remove cquotet.txt
    set %cqt.mask $replace(%cqt.word,$chr(32),*)
    set %cqt.mask * $+ %cqt.mask $+ *
    filter -ffn cquote.txt cquotet.txt %cqt.mask
    set %cqt.filtered $filtered
    set %cqt.foundn $lines(cquotet.txt)
    set %cqt.max $lines(cquotet.txt)
    if ($filtered != 0) {
      :start
      inc %cqt.cur
      if (%cqt.cur > %cqt.max) { goto die }
      set %cqt.curq $read -nl $+ %cqt.cur cquotet.txt
      .notice $1 $cqu Quote $left(%cqt.curq,60) $+ ..
      goto start
    }
    :die
    if ($filtered != 0) { .notice $1 $cqu Found $lines(cquotet.txt) Quote(s) Matching $2- }
    if ($filtered = 0) { .notice $1 $cqu Nothing Matching Your Search Request Was Found }
    set %cqt.ticks $calc($ticks - %cqt.start)
    .notice $1 $cqu Total Search Time: $duration($rrpt(%cqt.ticks)) 
  }
}
on *:text:*:#:{
  if ($1 = !sayquote) { 
    if (%cqt.sqtrigger = on) { 
      if (%cqt.meth = msgnick) { 
        .msg $nick $cqt.rquote($2-)
      }
      if (%cqt.meth = notnick) {
        .notice $nick $cqt.rquote($2-)
      }
      if (%cqt.meth = msgchan) {
        msg $chan $cqt.rquote($2-)
      }
      if (%cqt.meth = notchan) {
        notice $chan $cqt.rquote($2-)
      }
    }
  }
  if ($1 = !addquote) { 
    if (%cqt.adqtrigger = on) {
      write cquote.txt $2-
      if (%cqt.meth = msgnick) { 
        .msg $nick $cqu Added Quote Number $lines(cquote.txt) $+ : $2- 
      }
      if (%cqt.meth = notnick) {
        .notice $nick $cqu Added Quote Number $lines(cquote.txt) $+ : $2- 
      }
      if (%cqt.meth = msgchan) {
        msg $chan $cqu Added Quote Number $lines(cquote.txt) $+ : $2- 
      }
      if (%cqt.meth = notchan) {
        notice $chan $cqu Added Quote Number $lines(cquote.txt) $+ : $2- 
      }
    } 
  }
  if ($1 = !findquote) { if (%cqt.fquotetrigger = on) { cqt.rfindquote $nick $2- } }
}
alias cqt.listquotes {
  set %cqt.lchan $active
  window -l @Quotes
  set %cqt.max $lines(cquote.txt)
  set %cqt.cur 0
  :lquotesstart
  inc %cqt.cur
  if (%cqt.cur > %cqt.max) { halt }
  aline @Quotes $cqu Quote %cqt.cur $+ : $read -nl $+ %cqt.cur cquote.txt
  goto lquotesstart
}
MENU @Quotes {
  DCLICK {
    set %line $sline(@Quotes,1).ln
    msg %cqt.lchan $cq $$+ %cqt.sep $$+ %line $$+ ] $read -nl $+ %line cquote.txt
  }
}
MENU @QuotesFound {
  DCLICK {
    msg %cqt.curf $sline(@QuotesFound,1)
  }
}
alias cqt.ehelp {
  echo -a $cqu cQuote %cqt.ver Help
  echo -a $cqu
  echo -a $cqu Trigger Options
  echo -a $cqu
  echo -a $cqu Notice Nick
  echo -a $cqu Notices The Person Who Used A Trigger With The Response.
  echo -a $cqu
  echo -a $cqu Msg Nick
  echo -a $cqu Private Messages The Person Who Used A Trigger With The Response.
  echo -a $cqu
  echo -a $cqu Notice Chan
  echo -a $cqu Notices The Channel That The Trigger Was Used In With The Response.
  echo -a $cqu
  echo -a $cqu Msg Chan
  echo -a $cqu Says The Results Of The Trigger's Command To The Channel It Was Used In.
}
alias cqt.help {
  echo -a $cqu cQuote %cqt.ver Help
  echo -a $cqu
  echo -a $cqu Commands
  echo -a $cqu
  echo -a $cqu /sayquote [n]
  echo -a $cqu Says Either A Random Quote (If You Dont Specify
  echo -a $cqu a Number) Or Says Quote Number [n] To The Active
  echo -a $cqu Channel/Query/Chat.
  echo -a $cqu
  echo -a $cqu /findquote <words>
  echo -a $cqu Searches your quote database for quotes that contain
  echo -a $cqu <words>. If any are found, the quote number is indicated
  echo -a $cqu so you can then say the quote with /sayquote. (See Above.)
  echo -a $cqu
  echo -a $cqu /addquote <quote>
  echo -a $cqu Adds A Quote To Your Database.
}
alias cqt.thelp {
  echo -a $cqu cQuote %cqt.ver Help
  echo -a $cqu
  echo -a $cqu Triggers
  echo -a $cqu
  echo -a $cqu !sayquote [n]
  echo -a $cqu Allows Users To Get $cqu To Say Either A Random Quote Or
  echo -a $cqu Quote Number [n] To The Channel.
  echo -a $cqu
  echo -a $cqu !addquote <quote>
  echo -a $cqu Allows Users To Add Quotes To Your Database.
  echo -a $cqu
  echo -a $cqu !findquote <words>
  echo -a $cqu Allows Users To Search Your Quotes Database.
}

alias sayquote /cqt.sayquote $1-
alias addquote /cqt.addquote $1-
alias findquote /cqt.findquote $1-
alias listquotes /cqt.listquotes