#name: quote.irc #author: phos #date: 11/30/04 (original) #my second jircii script #/load quote.irc #/quote # shoutout alyssa era tane bc ice #feedback >> danfare@jircii.info # #keep an eye out for the full package of these scripts #called deep within the next year :) echo("quote.irc: type /quote for list of commands"); alias quote { echo("/quote help" . "h" x 23); echo("h /addquote: /addquote \b\b h" ); echo("h /remquote: /remquote \b#NUM\b h"); echo("h /listquote: /listquote h"); echo("h /pubquote: /pubquote \bON|OFF\b h"); echo("h" x 34); } on public { if ($1 eq '!quote') { #foreach $temp (keys(%localData)) { $value = %localData[$temp]; echo("$[20]temp = $value"); } $left = left($2, 1); $right = right($2-, 1); if (($left eq '*') || ($right eq '*')) { call("/searchquote -p $nick $target $2-"); return; } if (!-istrue $2) { $path = getScriptResource("quote.irc", "quote.lst"); $quotelist = openf($path); @qlist = readAll($quotelist); $x = rand(size(@qlist)); $rx = $x - 1; call("/msg $target # $+ $x $+ : " . @qlist[$rx]); closef($quotelist); return; } } if ($1 eq '!addquote') { $qupub = getProperty(qupub); if ($qupub eq 'off') { return; } if (!-istrue $2) { call("/notice $nick !addquote: !addquote \bquote\b"); return; } call("/notice $nick !addquote: added quote."); call("/addquote $2-"); } return; } alias pubquote { if (($1 eq 'on') || ($1 eq 'off')) { setProperty(qupub, "$1"); $qupub = getProperty(qupub); echo("/pubquote: turned the public !addquote: $qupub"); return; } $qupub = getProperty(qupub); echo("/pubquote: /pubquote \bon|off\b :: currently: $qupub") } alias listquote { $path = getScriptResource("ajoin.irc", "quote.lst"); if (!-isFile $path) { echo("/listquote: there are currently no quotes in database ref: /addquote"); return; } $quotelist = openf($path); @qlist = readAll($quotelist); echo("$network" . "h" x $x; ); for ($x = 0; $x < size(@qlist); $x++) { $rx = $x + 1; $temp = @qlist[$x]; echo("# $+ $[3]rx $temp"); } closef($quotelist); return; } alias addquote { $path = getScriptResource("quote.irc", "quote.lst"); $x = ">> $+ $path"; $quotelist = openf("$x"); println($quotelist, $1-); echo("/addquote: adding quote database: $1-"); closef($quotelist); return; } alias searchquote { if (!-istrue $1) { echo("/searchquote: /searchquote *wild*card*"); return; } $path = getScriptResource("quote.irc", "quote.lst"); $quotelist = openf($path); @qlist = readAll($quotelist); if ($1 eq '-p') { clear(@mqlist); foreach $q (@qlist) { if ($4- iswm "$q") { if (size(@mqlist) eq "0") { $x = 0 } @mqlist[$x] = $q; $x = $x + 1; } } if (size(@mqlist) eq "0") { call("/notice $2 sorry, $4- does not have any matches"); return; } $x = rand(size(@mqlist)); call("/msg $3 Quote: " . @mqlist[$x]); return; } foreach $q (@qlist) { if ($1- iswm "$q") { echo("matched $q"); } } closef($quotelist); return; } alias remquote { if (!-istrue $1) { echo("/remquote: /remquote \b#NUM\b"); return; } $path = getScriptResource("ajoin.irc", "quote.lst"); if (!-isFile $path) { echo("/remquote: there are currently no quotes in database ref: /addquote"); return; } $quotelist = openf($path); @qlist = readAll($quotelist); if (!-istrue @qlist[0]) { echo("/remquote: there are currently no quotes in database ref: /addquote"); return; } closef($quotelist); $quln = strlen($1) - 1; $qurt = right($1, $quln); if ((charAt($1, 0) !eq '#') || (!-isnumber $qurt)) { echo("/remquote: /remquote \b#NUM\b"); return; } else { $rqurt = $qurt - 1; #get number one less cause arrays start at 0 $rmqu = @qlist[$rqurt]; removeAt(@qlist, $rqurt); echo("/remchan: removing quote from database: $rmqu"); $quotelist = openf("> $+ $path"); if (!-istrue @qlist[0]) { echo("/ajoin: there are no quotes in your database, skipping re-write"); return; } for ($x = 0; $x < size(@jlist); $x++) { if (-istrue @qlist[$x]) { println($quotelist, @qlist[$x]); } } closef($quotelist); } }