QOQuote v1 for mIRCBy: [Talon]
Last Modified: Jan 17 5:40am (r8)

Pretty advanced quote script. Talk to me on utonet if you have any ideas or bugs. Im always in #scripting.
NEW!: /quoteedit
Aliases and remotes:
param - Nothing, quote number or text string.
--- Nothing - Will return a random quote.
--- Quote number - will return the requested quote or a quote not found error.
--- Text string - the most advanced, it will return one of three things:
------ A quote not found error.
------ The quote with the matching string.
------ If there are more than one match a list of the numbers of all quotes that contain the search string.
!quote param
--- A trigger for people in channels or queries.
/quote param
--- An alias to display a quote. Works in channels and queries.
/allquote param
--- This is the same as quote but before displaying a quote it says !quote in the channel so that everyone with a quote script displays a quote. Channels only.
/echoquote param
--- This alias echoes a quote to you only. Works anywhere.
/addquote quote text
--- Add the specified text to the quote file.
/deletequote quote number
--- Delete the specified quote number. Caution: it does not
ask if you are sure.
/quoteedit
--- Gives you the quote edit dialog box
/quotecount
--- Echoes how many quotes you have in your file.
NEW!: /quoteedit
Aliases and remotes:
param - Nothing, quote number or text string.
--- Nothing - Will return a random quote.
--- Quote number - will return the requested quote or a quote not found error.
--- Text string - the most advanced, it will return one of three things:
------ A quote not found error.
------ The quote with the matching string.
------ If there are more than one match a list of the numbers of all quotes that contain the search string.
!quote param
--- A trigger for people in channels or queries.
/quote param
--- An alias to display a quote. Works in channels and queries.
/allquote param
--- This is the same as quote but before displaying a quote it says !quote in the channel so that everyone with a quote script displays a quote. Channels only.
/echoquote param
--- This alias echoes a quote to you only. Works anywhere.
/addquote quote text
--- Add the specified text to the quote file.
/deletequote quote number
--- Delete the specified quote number. Caution: it does not
ask if you are sure.
/quoteedit
--- Gives you the quote edit dialog box
/quotecount
--- Echoes how many quotes you have in your file.

;================================================
;=== QOQuote
;================================================
;Returns the quote file. You may change the quotes
;####NOTE####: This is what you change to change where your quotes are stored!!!
;file for the entire script by changing this.
alias -l QuoteFile {
return quotes.txt
}
;returns the quote formated to send.
;####NOTE####: This is what you change to change the appearence of your quotes!!!
;To change this the variable $1 holds the quote number and $2-
;holds the quote itself.
alias -l GetQuoteStringFormat {
return [QOQuote] :: !quote :: $1 :: $2- ::
}
;#####################################################################
;#####################################################################
;######## Change nothing past here. Unless your really smert! ########
;#####################################################################
;#####################################################################
;returns a quote string based on given input
;not for direct user use.
alias -l GetQuoteString {
var %num
var %text
if ( $calc( $1 ) > 0 ) {
%num = $calc( $1 )
if ( %num < 1 || %num > $lines($QuoteFile) ) {
%text = Quote %num not found.
%num = -
}
else {
%text = $read($QuoteFile, %num)
}
}
else {
if ( $1 != $null ) {
%text = $read($QuoteFile, w, * $+ $1- $+ *)
if ( $readn == 0 ) {
%text = Quote ' $+ $1- $+ ' not found.
%num = -
}
else {
while ( $readn > 0 ) {
%num = %num $+ , $+ $readn
%temp = $read($QuoteFile, w, * $+ $1- $+ *, $calc($calc($readn)+1))
}
%num = $right(%num, $calc($len(%num)-1))
if ( $count(%num,$chr(44)) > 0 ) {
%text = String ' $+ $1- $+ ' found in quotes %num $+ .
%num = -
}
}
}
else {
%num = $rand(1, $lines($QuoteFile))
%text = $read($QuoteFile, %num)
}
}
return $GetQuoteStringFormat(%num, %text)
}
;Add a quote to the quotes file
alias AddQuote {
write $QuoteFile $1-
echo [QOQuote] :: Added as $lines($QuoteFile) :: $1- ::
}
;delete specifed quote #
alias DeleteQuote {
if ( $calc( $1 ) > 0 ) {
if ( $calc( $1 ) < 1 || $calc( $1 ) > $lines($QuoteFile) ) {
echo [QOQuote] :: 4Error :: Quote $calc( $1 ) not found. ::
}
else {
echo [QOQuote] :: Deleted $calc( $1 ) :: $read($QuoteFile, $calc( $1 )) ::
write -dl $calc( $1 ) $QuoteFile
}
}
else {
echo [QOQuote] :: 4Error :: No quote to delete specified. ::
}
}
;say a quote in the current window (chan or query)
alias Quote {
if ( $chan != $null ) {
msg $chan $GetQuoteString($1-)
}
else {
msg $active $GetQuoteString($1-)
}
}
;Say !quote in the current chan and then give a quote
alias AllQuote {
msg $chan !quote $1-
quote $1-
}
;echo a quote to the user
alias EchoQuote {
echo $GetQuoteString($1-)
}
;Trigger to give a quote in a channel or query
on 1:TEXT:!quote*:*:{
if ( $chan != $null ) {
msg $chan $GetQuoteString($2-)
}
else {
msg $nick $GetQuoteString($2-)
}
}
;echo how many quotes the user has
alias QuoteCount {
echo You have $lines($QuoteFile) quotes in $QuoteFile
}
;#####################################################################
;#################### Dialog stuff and the like. #####################
;#####################################################################
;dialog table
dialog -l QOQDT {
title "QOQuote"
size -1 -1 600 268
option pixel
button "Close", 1, 492 8 100 25, ok
button "Remove", 2, 492 138 100 25, disable
button "Save Changes", 3, 492 171 100 25, disable
list 4, 8 8 478 200
edit "", 5, 8 208 584 50, disable, multi, vsbar
}
;init the form: load quotes into list
on 1:dialog:QOQDialog:init:0: {
var %i
var %line
var %lines
%lines = $lines($QuoteFile)
%i = 1
while ( %i <= %lines ) {
did -a QOQDialog 4 $read($QuoteFile, %i)
inc %i
}
}
;handles removing the selected quote
on 1:dialog:QOQDialog:sclick:2: {
var %line
%line = $did(QOQDialog, 4, 1).sel
did -d QOQDialog 4 %line
did -b QOQDialog 2,5
did -r QOQDialog 5
write -dl $+ %line $QuoteFile
if ( %line > 1 ) {
did -c QOQDialog 4 $calc(%line - 1)
did -e QOQDialog 2
}
}
;handles saving the changes one a quote
on 1:dialog:QOQDialog:sclick:3: {
var %text
var %i
%i = 1
while ( %i <= $did(QOQDialog, 5).lines ) {
%text = %text $did(QOQDialog, 5, %i).text
inc %i
}
did -b QOQDialog 3
did -o QOQDialog 4 %qoquote.selline %text
did -c QOQDialog 4 %qoquote.selline
write -l $+ %qoquote.selline $QuoteFile %text
}
;handles a quote being selected in the list
on 1:dialog:QOQDialog:sclick:4: {
%qoquote.selline = $did(QOQDialog, 4, 1).sel
did -e QOQDialog 2,5
did -b QOQDialog 3
did -r QOQDialog 5
did -a QOQDialog 5 $did(QOQDialog, 4, $did(QOQDialog, 4, 1).sel).text
}
;handles enabling the save button when a quote is changed
on 1:dialog:QOQDialog:edit:5: {
did -e QOQDialog 3
}
;command to show the dialog...wewt
alias QuoteEdit {
/dialog -m QOQDialog QOQDT
}
|

Comments| Pauly May 02 11:24pm | A few things .... Firstly, /quote is a command in mIRC (which is virtually obsolete, but still). I suggest another one personally (I used /quoter). Second, ";Say !quote in the current chan and then give a quote alias AllQuote { msg $chan !quote $1- quote $1- } " can be replaced with .... "On *:INPUT:#: { msg $chan !quote $1- quote $2- halt }" And will allow them to just type !quote to display their quote:) | ||
![]() | |||
| arcane May 03 3:21am | I like to use /q myself. | ||
![]() | |||
| Elly May 04 7:48pm | I ought to point out that Pauly's fix will cause you to always say a quote, even if you don't want to. | ||
![]() | |||
| Pauly May 04 7:50pm | "On *:INPUT:#: if ( !quote == $1 ) { msg $chan !quote $1- quote $2- halt }" Better?:) | ||
![]() | |||
| [Talon] May 05 5:41am | Heh Pauly sure didnt look this one over well...this what that does... [&[talon]]: !quote yar [&[talon]]: !quote !quote yar [&[talon]]: [QOQuote] :: !quote :: - :: Quote 'yar' not found. :: This will fix that: on 1:INPUT:#: { if ( !quote == $1 ) { quote $2- halt } } Note the fact that I use syntax much more like that of C\C++ ...a real programming language. | ||
![]() | |||
| [Talon] May 05 5:47am | Somthing else I forgot to say...Meh @ /quoter or /q to keep it from messin up /quote ...if the use is smart enough to use /quote then they darn well oughta be able to change an alias. | ||
![]() | |||
| Master Healexarn Jul 05 10:39pm | /me pukes Oh, I'm sorry. I'll clean that up later. I was just sickened by the code that was in the comments. Anyway... The coding that composes the QOQuote script is alright. I'll just dive straight into the code in the comments, and review the mistakes with commentary of my own. You guys really need to learn how to use on INPUT properly. The first on INPUT remote that Pauly created did exactly as Elly said. It activated the quote script no matter what the user typed. Furthermore, the orignal command that the user inputted would not execute. Pauly alterated it in his next comment. This remote still had problems, however. As Talon correctly noted, the term "!quote" would appear twice in a single line as a result of the coding. However, Talon uncorrectly noted that the original input would reach the server, which is untrue because of the halt command. Talon then tried to correct the on INPUT remote. He took out the /msg command, which is unthoughtful just by itself, but he also failed to remove the /halt command, which completely removed the purpose of the on INPUT remote. With Talon's revision, the other quote scripts would not be activated with "!quote" whatsoever. With all that being said, I will now present the correct on INPUT remote. on *:INPUT:*:{ if ($1 == !quote) { haltdef msg $active $1- quote $2- } } I'm not done yet, though. I would recommend NOT using an on INPUT command to replace /allquote. You can only have one active instance of an on INPUT remote in your entire script file, and there's really not a clear advantage of replacing /allquote with an on INPUT remote. In fact, once you do make the switch, you will lose your capability to activate other quote scripts using !quote without activating your own (without temporarily alterating the code, of course), which you might want to do in some cases. However, there is a change that I would recommend to /allquote. Most of the script is functional in channels as well as query windows. This functionality is stripped from /allquote. It can be fixed simply by replacing "msg $chan !quote $1-" with "msg $active !quote $1-". That's all. /me flies away | ||
![]() | |||
| arcane Jul 07 11:50pm | One thing that I find handy is this in my popups for Channel and Query windows:
then back with this script:
| ||
![]() | |||
| Master Healexarn Jul 09 11:44pm | That is quite handy, indeed. | ||
![]() | |||
| [Talon] Sep 09 5:41pm | You know I made some massive updates to this, then promply lost them... it kinda sucks... I dont know quite how i did it. | ||
![]() | |||
