Quote System

By Tidum on Dec 06, 2010

Screenshots

It's a quote system that can be run through commands and a dialog.
/quote search Searches quotes for quotes matching the term.
/quote clear Clears all quotes.
/quote Messages active window a random quote.
/quote last Messages active window last quote added.
/quote total Echoes total number of quotes.
/quote Messages quote number.
/addquote Adds the quote and tells the number.
/quotes Opens the quote dialog.

Hope you like it.

UPDATE: Fixed the "/quote pass" problem with BNC's

dialog Quotes {
  title "Quotes"
  size -1 -1 200 200
  option dbu
  list 1, 5 5 190 150
  button "Add", 2, 10 160 40 20
  button "Del", 3, 55 160 40 20, disable
  button "Clear", 4, 100 160 40 20
  button "Message", 5, 145 160 40 20, disable
}
on 1:dialog:Quotes:*:*:{
  if ($devent == sclick) { 
    if ($did == 1) {
      did -e $dname 3,5
    }
    if ($did == 2) {
      dialog -m Add.Quote Add.Quote
    }
    if ($did == 3) {
      write -dl $+ $did(1).sel Quotes.txt
      did -d $dname 1 $did(1).sel
      did -b $dname 3,5
    }
    if ($did == 4) {
      write -c Quotes.txt
      did -r $dname 1
      did -b $dnaem 3,5
    }
    if ($did == 5) {
      var %x 1
      var %z 0
      while ($read(Quotes.txt,%x)) {
        inc %z
        inc %x
      }
      msg $active 14S07elected 14Q07uote14(07 $+ $did(1).sel $+ 14/07 $+ %z $+ 14)00: $did(1).seltext
    }
  }
  if ($devent == init) {
    var %x 1
    while ($read(Quotes.txt,%x)) {
      did -a $dname 1 $read(Quotes.txt,%x)
      inc %x
    }
  }
}
dialog Add.Quote {
  title "Add Quote"
  size -1 -1 200 40
  option dbu
  edit "", 1, 5 5 190 10, autohs
  button "Ok", 2, 70 20 20 10
  button "Cancel", 3, 90 20 20 10
}
on 1:dialog:Add.Quote:*:*:{
  if ($devent == sclick) {
    if ($did == 2) {
      write Quotes.txt $did(1)
      if ($dname == Add.Quote) {
        did -a Quotes 1 $did(1)
        dialog -x $dname $dname
      }
    }
    if ($did == 3) {
      dialog -x $dname $dname
    }
  }
}
alias quotes { dialog -m Quotes Quotes }
alias quote {
  if (!$1) { 
    if ($lines(Quotes.txt) == 0) { echo -a 14No quotes. | halt }
    else { var %x $r(1,$lines(Quotes.txt)) | msg $active 14R07andom 14Q07uote14(07# $+ %x $+ 14)00: $read(Quotes.txt,%x) }
  }
  else {
    if ($1 == pass) { noop $1- }
    if ($1 == clear) { echo -a 14Clearing quotes... | write -c Quotes.txt | .timer 1 2 echo -a 14Clear all quotes. | halt }
    if ($1 == total) { echo -a 14Total number of quotes:07 $lines(Quotes.txt) | halt }
    if ($1 == search) {
      if ($2) {
        var %x 1
        var %number $null
        echo -a 14Searching through quote database for07 $2 $+ 14...
        while ($read(Quotes.txt,%x)) {
          if ($2 isin $read(Quotes.txt,%x)) {
            var %number $addtok(%number,%x,32)
            inc %x
          }
          else { inc %x }
        }
        if (%number) { .timer 1 2 echo -a 14Found quotes matching07 $2 $+ 14:07 %number }
        else { .timer 1 2 echo -a 14No quotes found matching07 $2 $+ 14. }
      }
      halt
    }
    if ($1 == last) { msg $active 14L07ast 14Q07uote14(07# $+ $lines(Quotes.txt) $+ 14)00: $read(Quotes.txt,$lines(Quotes.txt)) | halt }
    if ($read(Quotes.txt,$1)) { msg $active 14S07elected 14Q07uote14(07 $+ $1 $+ 14/07 $+ $lines(Quotes.txt) $+ 14)00: $read(Quotes.txt,$1) }
    else { echo -a 14No quote on that line. }
  }
}
alias addquote {
  write Quotes.txt $1-
  echo -a 14Added quote07 $1- 14to the database at line number07 $lines(Quotes.txt) $+ 14.
}
menu * {
  Quotes System:quotes
}

Comments

Sign in to comment.
DevilHunter   -  Mar 04, 2011

Ok, I really want to use this. But it don't work. What window do you put it in?

 Respond  
Dark|   -  Dec 07, 2010

I Thouht you loaded sbnc into psybnc

>
<
<

 Respond  
napa182   -  Dec 07, 2010

Tidum, maybe add a hsbar on ur listbox.

as well instead of doing this to open up ur dialogs

dialog -m Quotes Quotes

use

dialog $iif($dialog(Quotes),-v,-md Quotes) Quotes

just so you don't get already open errors

 Respond  
Wader   -  Dec 07, 2010

you also have ProBNC, ZNC, BNC-XML, sBNC and loads more do, although most you can use /znc or /sbnc ect, many have instructions to use /quote so those who have never used a bnc before will use the /quote way. :)

 Respond  
Dark|   -  Dec 06, 2010

Lol wader,
the only bnc that i know that does that is psybnc

 Respond  
blackvenomm666   -  Dec 06, 2010

yay screenshot

 Respond  
blackvenomm666   -  Dec 06, 2010

lookin good tids. you should start doin screen shots for your dialog stuff though:)

 Respond  
Tidum   -  Dec 06, 2010

I'll make an update.

 Respond  
Wader   -  Dec 06, 2010

i quite like it, done a little modification to make it work for my bot. Although i might just say, many BNC servers use /quote as a was of communicating with the server, might i suggest changing it to /quotem or something like that.

 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.