Quoterv1.0

By cdcyborg on Jul 30, 2005

My simple Quote script. When you add the script to mirc, load it and then the setup will easily set it up :) You can use all commands that are used in the channel on that irc using /command Eg. !quotehelp > u use > /quotehelp

on *:LOAD: {
  /echo -a Thanks for using Quoter v1.0 By cdcyborg.
  /echo -a Use /quotehelp for all the commands.
  /writeini quote.ini admins $$?="Who is the bot admin?" yes
  /writeini quote.ini misc channel $$?="what channel will the quote script be active in?"
  /msg $readini(quote.ini, [np], misc, channel) Quote Script Enabled.
  /writeini quote.ini misc limit unlimited
}

on *:TEXT:!quotehelp*:#: {
  if ($chan !== $readini(quote.ini, [np], misc, channel)) { Halt }
  elseif ($readini(quote.ini, [np], bans, $nick $+ ) == yes) { Halt }
  elseif (!$2) {
    /msg $chan {6Quote} Normal Commands: !addquote; !quote; !qlimit; !quotes; !lastquote;
    /msg $chan {6Quote} Admin Commands: !delquote; !setqlimit; !setqchan; !quote <on/off>; !aqban; !dqban;
    /msg $chan {6Quote} Use !quotehelp <command> For more information on a certain command.
    Halt
  }
  elseif ($2 == !addquote) {
    /msg $chan {6Quote} !addquote - Used to add your own quote. Usage: !addquote <quote here>
    Halt
  }
  elseif ($2 == !quote) {
    /msg $chan {6Quote} !quote - This shows a random quote from my quote database. You can also use !quote <number> To view a certain quote.
    Halt
  }
  elseif ($2 == !qlimit) {
    /msg $chan {6Quote} This shows you the maximum allowed quotes in my database.
    Halt
  }
  elseif ($2 == !quotes) {
    /msg $chan {6Quote} This will show you how many quotes are currently in my database.
    Halt
  }
  elseif ($2 == !delquote) {
    /msg $chan {6Quote} This deletes a quote in my database. Usage: !delquote <quote number>
    Halt
  }
  elseif ($2 == !setqlimit) {
    /msg $chan {6Quote} This changes the limit of quotes allowed in my database. Usage: !quotelimit <new limit>
    Halt
  }
  elseif ($2 == !setqchan) {
    /msg $chan {6Quote} This changes the channel the quote script will respond to.
    Halt
  }
  elseif ($2 == !aqban) {
    /msg $chan {6Quote} This adds <nick> to the quote ban list.
    Halt
  }
  elseif ($2 == !dqban) {
    /msg $chan {6Quote} This dels <nick> from the quote ban list.
    Halt
} }

on *:TEXT:!addquote*:#: {
  if ($chan !== $readini(quote.ini, [np], misc, channel)) { Halt }
  elseif ($readini(quote.ini, [np], bans, $nick $+ ) == yes) { Halt }
  elseif ($readini(quote.ini, [np], misc, status) == off) {
    /msg $chan {6Quote} Sorry $nick $+ , The quote script is currently Disabled by admin.
  }
  elseif ($lines(quotes.txt) == $readini(quote.ini, [np], misc, limit) $+ ) {
    /msg $chan {6Quote} There is currently the maximum allowed quotes in my database. ( $+ $readini(quote.ini, [np], misc, limit) $+ )
  }
  elseif (!$2) {
    /msg $chan {6Quote} Usage: !addquote <quote here>
  }
  else {
    /write quotes.txt $2- (Added by $nick at $time on $date $+ )
    /msg $chan {6Quote} $2- Has been added to my quote database.
} }

on *:TEXT:!aqban*:#: {
  if ($readini(quote.ini, [np], admins, $nick $+ ) !== yes) {
    /msg $chan {6Quote} You cant use this command.
  }
  elseif ($readini(quote.ini, [np], bans, $2 $+ ) == yes) {
    /msg $chan {6Quote} $2 is already banned from using the quote script.
  }
  else {
    /writeini quote.ini bans $2 yes
    /msg $chan {6Quote} $2 Has been banned from using the quote script.
} }

on *:TEXT:!dqban*:#: {
  if ($readini(quote.ini, [np], admins, $nick $+ ) !== yes) {
    /msg $chan {6Quote} You cant use this command.
  }
  elseif ($readini(quote.ini, [np], bans, $2 $+ ) !== yes) {
    /msg $chan {6Quote} $2 is not banned from using the quote script.
  }
  else {
    /remini quote.ini bans $2
    /msg $chan {6Quote} $2 Has been allowed to use the quote script.
} }

on *:TEXT:!setqchan*:#: {
  if ($chan !== $readini(quote.ini, [np], misc, channel)) { Halt }
  elseif ($readini(quote.ini, [np], admins, $nick $+ ) !== yes) {
    /msg $chan {6Quote} Your cant use this command.
  }
  elseif (# !isin $2) {
    /msg $chan {6Quote} Invalid Channel.
  }
  else {
    /writeini quote.ini misc channel $2
} }

on *:TEXT:!qlimit:#: {
  if ($chan !== $readini(quote.ini, [np], misc, channel)) { Halt }
  elseif ($readini(quote.ini, [np], bans, $nick $+ ) == yes) { Halt }
  else {
    /msg $chan {6Quote} Quote Limit: $readini(quote.ini, [np], misc, limit)
} }

on *:TEXT:!setqlimit*:#: {
  if ($chan !== $readini(quote.ini, [np], misc, channel)) { Halt }
  elseif ($readini(quote.ini, [np], admins, $nick $+ ) !== yes) {
    /msg $chan {6Quote} Your cant use this command.
  }
  elseif ($2 isnum) {
    /writeini quote.ini misc limit $2
    /msg $chan {6Quote} Quote limit set to $2 $+ .
  }
  elseif ($2 == unlimited) {
    /writeini quote.ini misc limit 999999999999999
    /msg $chan {6Quote} Quote limit set to $2 $+ .
} }

on *:TEXT:!delquote*:#: {
  if ($chan !== $readini(quote.ini, [np], misc, channel)) { Halt }
  elseif ($readini(quote.ini, [np], admins, $nick $+ ) !== yes) || ($nick !isop $chan) {
    /msg $chan {6Quote} Your cant use this command.
  }
  elseif ($2 !isnum) {
    /msg $chan {6Quote} Usage: !delquote (1 - $lines(quotes.txt) $+ )
  }
  elseif ($2 > $lines(quotes.txt) $+ ) {
    /msg $chan {6Quote} $2 is an invalid Quote.
  }
  else {
    /write -dl $+ $2 quotes.txt
    /msg $chan {6Quote} Quote $2 Deleted.
} }

on *:TEXT:!quotes:#: {
  if ($chan !== $readini(quote.ini, [np], misc, channel)) { Halt }
  elseif ($readini(quote.ini, [np], bans, $nick $+ ) == yes) { Halt }
  elseif ($lines(quotes.txt) == 1) {
    /msg $chan {6Quote} There is currently 1 Quote in my database.
  }
  else {
    /msg $chan {6Quote} There is currently $lines(quotes.txt) Quotes in my database.
} } 

on *:TEXT:!lastquote:#: {
  if ($chan !== $readini(quote.ini, [np], misc, channel)) { Halt }
  elseif ($readini(quote.ini, [np], bans, $nick $+ ) == yes) { Halt }
  else {
    /msg $chan {6Last Quote} $read(quotes.txt, $lines(quotes.txt) $+ )
} }

on *:TEXT:!quote*:#: {
  if ($chan !== $readini(quote.ini, [np], misc, channel)) { Halt }
  elseif ($readini(quote.ini, [np], misc, admin) == $nick $+ ) && ($2 == off) {
    /writeini quote.ini misc status off
    /msg $chan {6Quote} Quoter Script by cdcyborg Disabled.
    Halt
  }
  elseif ($readini(quote.ini, [np], misc, admin) == $nick $+ ) && ($2 == on) {
    /writeini quote.ini misc status on
    /msg $chan {6Quote} Quoter Script by cdcyborg Enabled.
  }
  elseif ($readini(quote.ini, [np], bans, $nick $+ ) == yes) { Halt }
  elseif ($readini(quote.ini, [np], misc, status) == off) {
    /msg $chan {6Quote} Sorry $nick $+ , The quote script is currently Disabled by admin.
    Halt
  }
  elseif ($2) && ($2 !isnum) {
    /msg $chan {6Quote} To search a quote, Use !quote (1 - $lines(quotes.txt) $+ )
    Halt
  }
  elseif ($lines(quotes.txt) == 0) {
    /msg $chan {6Quotes} There is currently 0 Quotes in my database.
    Halt
  }
  elseif ($2 > $lines(quotes.txt)) {
    /msg $chan {6Quote} $2 is an invalid quote number.
    Halt
  }
  elseif ($2) {
    /set %quote.no $2
    /set %quote.wh $read(quotes.txt, %quote.no $+ ) 
    /msg $chan {6Quote} %quote.no $+ : %quote.wh
    Halt
  }
  elsif (!$2) {
    /set %quote.no $rand(1, $lines(quotes.txt) $+ )
    /set %quote.wh $read(quotes.txt, %quote.no $+ ) 
    /msg $chan {6Random Quote} %quote.no $+ : %quote.wh
    Halt
} }
alias /quotehelp {
  /echo -a 4>7--------------------------------------------
  /echo -a 4>12 Normal Commands:
  /echo -a 4>12 !addquote; !quote; !qlimit; !quotes; !lastquote
  /echo -a 4>12 Admin Commands:
  /echo -a 4>12 !delquote; !quotelimit <New Limit>; !qchan <New Quote Channel>; !quote <on/off>
  /echo -a 4>7--------------------------------------------
}
alias /delquote {
  if ($lines(quotes.txt) == 0) {
    /echo -a {6Quote} There is 0 quotes in my database to delete.
  }
  elseif ($1 > $lines(quotes.txt)) {
    /echo -a {6Quote} $1 Is an invalid quote number.
  }
  else {
    /echo -a {6Quote} Quote $1 Deleted.
    /write -dl $+ $1 quotes.txt
} }
alias /quotes {
  if ($lines(quotes.txt == 1)) {
    /echo -a {6Quote} There is currently 1 Quote in my database.
  }
  else {
    /echo -a {6Quote} There is currently $lines(quotes.txt) Quotes in my database.
} }
alias /quote {
  if ($1 == on) {
    /msg $chan {6Quote} Quoter v1.0 By Cdcyborg Enabled.
    /writeini quote.ini misc status on
  }
  elseif ($1 == off) {
    /msg $chan {6Quote} Quotes v1.0 By Cdcyborg Disabled.
    /writeini quote.ini misc status off
  }
  elseif ($1) && ($1 > $lines(quotes.txt)) {
    /echo -a {6Quote} $1 is an invalid quote number.
  }
  elseif ($lines(quotes.txt) == 0) {
    /echo -a {6Quote} There is currently 0 Quotes in my database to say.
  }
  elseif ($1) {
    /set %rand.quote $1
    /msg $chan {6Quote} $read(quotes.txt, n, %rand.quote $+ )
  }
  elseif (!$2) {
    /set %rand.quote $rand(1, $+ $lines(quotes.txt) $+ )
    /msg $chan {6Random Quote} $read(quotes.txt, n, %rand.quote $+ )
} }
alias /lastquote {
  if ($lines(quotes.txt) == 0) {
    /echo -a {6Quote} There is currently 0 quotes in my database to say.
  }
  else {
    /msg $chan {6Last Quote} $read(quotes.txt,n, $lines(quotes.txt $+ ))
} }
alias /qchan {
  if (!$1) {
    /echo -a {6Quote} What channel should i set as the new quote channel?
  }
  else {
    /writeini quote.ini misc channel $1
    /echo -a {6Quote} Quote channel set as $1 $+ .
} }
alias /qlimit {
  /echo -a {6Quote} Current Quote limit is $readini(quote.ini, [np], misc, limit) $+ .
}
alias /setqlimit {
  if (!$1) {
    /echo -a {6Quote} Please put a new quote limit to be set. <number> or unlimited.
  }
  elseif ($2 isnum) {
    /echo -a {6Quote} Quote limit set as $1 $+ .
    /writeini quote.ini misc limit $2
  }
  elseif ($2 == unlimited) {
    /echo -a {6Quote} Quote limit set as $1 $+ .
    /writeini quote.ini misc limit 999999999999999
} }
alias /addquote {
  if (!$1) {
    /echo -a {6Quote} Please put a quote to add.
  }
  else {
    /write quotes.txt $1- (Added by $me at $time on $date $+ )
} }
alias /aqban {
  if ($readini(quote.ini, [np], bans, $1 $+ ) == yes) {
    /echo -a  {6Quote} $1 is already banned from using the quote script.
  }
  else {
    /writeini quote.ini bans $1 yes
    /echo -a {6Quote} $1 Has been banned from using the quote script.
} }
alias /dqban {
  if ($readini(quote.ini, [np], bans, $1 $+ ) !== yes) {
    /echo -a  {6Quote} $1 is not banned from using the quote script.
  }
  else {
    /remini quote.ini bans $1
    /echo -a {6Quote} $1 Has been allowed to use the quote script.
} }

Comments

Sign in to comment.
RoninWarrior   -  Aug 25, 2006

/writeini with no -n switch ?? not good http://www.hawkee.com/snippet.php?snippet_id=1520

please readd all of the comments before you say i am wroung there is a potential hazard here and it has been proven sevral times please use the -n switch anytime you use writeini and readini.

 Respond  
cdcyborg   -  Aug 25, 2006

its not so simple, alot of commands, try it. ;) and the /\'s i couldnt b bothered 2 remove them all after i made it.. lol i din realise i added them in

 Respond  
chaplja   -  Jul 30, 2005

haven\'t tried it yet, but you really don\'t need to use /\'s in ANY of your scripts, they won\'t have any effect - i see this in MANY snippets on this site, it\'s useless :)

they are used only when manually typing something in mIRC where is difference between one and two /\'s.

when using two /\'s, all identifers, variables and commands will be evaluated, when using one /, everything will be treated as plain text

 Respond  
DeathRyder082   -  Jul 30, 2005

Thats alot of coding for a \"simple Quote script\".

 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.