if ($1 == !quotefind) || ($1 == !qfind) {
if (!$2) { msg $chan Insufficient parameters. Syntax: $1 <matchword> | return }
; setting variables for 1) the line to start reading at 2) the matching lines (which is empty first)
var %nr = 1, %matches
; (loop): read the file starting at line nr. %nr
while ($read(quotes.txt,nw,* $+ $2- $+ *,%nr)) {
; as long as there is a matching line number, add it to the %matches variable
var %matches = %matches $readn
; and start the 'next' reading of the loop at the following line
var %nr = $calc($readn +1)
; the maximum length of a variable (it's name + it's data) is 942 chars -
; this line escapes a breaking of the script if there were too many matches
if ($len(%matches) > 920) { .msg $chan Too many matches for $qt($2-) | return }
}
; (end of loop)
; if more than one match was found:
if ($numtok(%matches,32) > 1) {
.msg $chan Found $v1 quotes matching $qt($2-) at the following lines: %matches
}
; if only one match was found:
elseif ($v1 == 1) {
tokenize 92 $read(quotes.txt,%matches)
.msg $chan 04 $+ $chr(91) Quote $1 $chr(93) $+ $2
.msg $chan 4Submitted by12: $3 4Rated12: $4
}
; if no match was found:
else {
.notice $nick $qt($2-) was not found in the quote database.
}
}