rendered paste bodyon *:TEXT:?help:#:{
if (%chelp.flood == 1) halt
elseif ($left($1,1) isin @!.) {
var %display $iif($left($1,1) == @,msg $chan,.notice $nick)
if ($chan isin $gettok(%silent,1-,32)) %display = .notice $nick
%display The syntax to use the lookup is [@|!|.]clan(s) (-p|-e) <nick>
%display Where @ is a public message and both ! and . are notices to you
%display Everything in parenthesis are optional. The -p switch is partial, while -e is exact
%display <nick> is just the person
%display An example of a public message is @clans Oww-My-Nose
timerdelay 1 5 {
%display -
%display To cancel a lookup you started, simply type cancel lookup
%display You will need to type 'yes' to cancel the lookup within 5 seconds of typing cancel lookup
%display This clan lookup is coded by Oww_My_Nose using [12owwScript]
set -u10 %chelp.flood 1
}
}
}
on *:TEXT:cancel lookup:#:{
if ($nick != %clan.nick) { halt }
else {
.notice $nick Are you sure you want to cancel the lookup? (must type yes within 5 seconds to cancel)
set -u5 %clan.cancel yes
}
}
on *:TEXT:yes:#:{
if ((!%clan.cancel) || ($nick != %clan.nick)) halt
else {
msg %clan.chan Lookup canceled
clan.cleanup
}
}
on *:TEXT:?clan*:#:{
if ($left($1,1) !isin @!.) halt
if (!$2) { notice $nick Enter a name plz | halt }
else {
if (%clan.use == 1) {
.notice $nick Sorry, but the clan lookup is being used $&
by12 %clan.nick in14 %clan.chan $+ [12owwScript]
halt
}
else {
if (-p* iswm $2 || -e* iswm $2) {
set %clan.name $replace($3-,$chr(32),$chr(95),$chr(45),$chr(95))
set %clan.search $iif($left($right($2,-1),2) == p,partial,exact)
}
else {
set %clan.name $replace($2-,$chr(32),$chr(95),$chr(45),$chr(95))
set %clan.search exact
}
if ($len(%clan.name) > 12) {
notice $nick Name cannot be longer than 12 characters
unset %clan.name
}
else {
set %clan.display $iif($left($1,1) == @,msg $chan,notice $nick)
if ($chan isin $gettok(%silent,1-,32)) %clan.display = notice $nick
.notice $nick Processing request... please wait about 1-2 minute for the Runehead server to respond
set %clan.nick $nick
set %clan.chan $chan
set %clan.found no
set %clan.use 1
clan.chk
.timerclan.timeout 1 120 notice $nick Sorry, but this script timed out connecting to runehead.com
.timerclan.timeout2 1 120 clan.cleanup
}
}
}
}
alias clans {
if (%clan.use == 1) {
echo -a Sorry, but the clan lookup is being used $&
by12 %clan.nick in14 %clan.chan $+ [12owwScript]
halt
}
if (-p* iswm $1 || -e* iswm $1) {
set %clan.name $replace($2-,$chr(32),$chr(95),$chr(45),$chr(95))
set %clan.search $iif($left($right($1,-1),2) == p,partial,exact)
}
else {
set %clan.name $replace($1-,$chr(32),$chr(95),$chr(45),$chr(95))
set %clan.search exact
}
if ($len(%clan.name) > 12) {
echo -a Name cannot be longer than 12 characters
unset %clan.name
}
else {
if ($active != #idle) msg $active @clans $1-
set %clan.display msg $active
if ($active isin $gettok(%silent,1-,32)) %clan.display = echo -a $timestamp $+ $chr(32)
echo -a Processing request... please wait about 1-2 minute for the Runehead server to respond
set %clan.nick $me
set %clan.chan $active
set %clan.found no
set %clan.use 1
clan.chk
.timerclan.timeout 1 120 echo -a Sorry, but this script timed out connecting to runehead.com
.timerclan.timeout2 1 120 clan.cleanup
}
}
alias clan.chk {
.sockopen clanlookup www.runehead.com 80
inc %clanlookup.uses
}
alias striphtml.clan {
var %clan.txt $gettok($1,3,62)
%clan.txt = $gettok(%clan.txt,1,60)
return %clan.txt
}
alias striphtml.site {
var %clan.txt.s $gettok($1,2,62)
%clan.txt.s = $gettok(%clan.txt.s,1,60)
%clan.txt.s = $gettok(%clan.txt.s,2,39)
return $+(www.runehead.com/clans/,%clan.txt.s)
}
alias striphtml.name {
var %clan.txt.n $gettok($1,3,62)
%clan.txt.n = $gettok(%clan.txt.n,1,60)
return %clan.txt.n
}
/*
alias clan.output.me {
open clanlookup.txt
var %clan.name.temp $upper($left(%clan.name,1)) $+ $right(%clan.name,-1),%d 1,%clan.name.temp2
while ($gettok(%clan.name.temp,%d,95)) {
%clan.name.temp2 = %clan.name.temp2 $upper($left($gettok(%clan.name.temp,%d,95),1)) $+ $&
$lower($right($gettok(%clan.name.temp,%d,95),-1))
inc %d
}
%clan.name = $replace(%clan.name.temp2,$chr(95),$chr(32))
var %i $iif(%clan.search == exact,1,3)
var %clan.output = $iif(%clan.search == exact,12 $+ $upper($left(%clan.name,1)) $+ $right(%clan.name,-1) $&
is currently in:,Results using a partial search for $&
12 $+ $upper($left(%clan.name,1)) $+ $right(%clan.name,-1) $+ :) $+ $&
$iif(%clan.search == exact,$chr(32),$chr(32) $+ $+(,$chr(91),14, $+ $&
$striphtml.name($read(clanlookup.txt,$calc(%i-1))),,$chr(93),) $+ $chr(32)) $+ $&
$+(12,$striphtml.clan($read(clanlookup.txt,%i)),) $&
14( $striphtml.site($read(clanlookup.txt,%i)) 14)
inc %i $iif(%clan.search == exact,1,2)
while ($read(clanlookup.txt,%i) != $null) {
if (($len(%clan.output) < 385 && $calc($len(- $+(12,$striphtml.clan($read(clanlookup.txt,%i)),) $+ $&
$iif(%clan.search == exact,$chr(32), $+(,$chr(91),14,$striphtml.name,,$chr(93),) ) $+ $&
14- $+ $striphtml.site($read(clanlookup.txt,%i)) $+ 14-) + $len(%clan.output)) < 385)) {
%clan.output = %clan.output $+ , $+(12,$striphtml.clan($read(clanlookup.txt,%i)),) $+ $&
$iif(%clan.search == exact,$chr(32),$chr(32) $+ $+(,$chr(91),14, $+ $&
$striphtml.name($read(clanlookup.txt,$calc(%i-1))),,$chr(93),) $+ $chr(32)) $+ $&
$+(12,$striphtml.clan($read(clanlookup.txt,%i)),) $&
}
elseif (($len(%clan.output2) < 385 && $calc($len(- $+(12,$striphtml.clan($read(clanlookup.txt,%i)),) $+ $&
$iif(%clan.search == exact,$chr(32), $+(,$chr(91),14,$striphtml.name,,$chr(93),) ) $+ $&
14- $+ $striphtml.site($read(clanlookup.txt,%i)) $+ 14-) + $len(%clan.output2)) < 385)) {
%clan.output2 = %clan.output2 $+ , $+(12,$striphtml.clan($read(clanlookup.txt,%i)),) $+ $&
$iif(%clan.search == exact,$chr(32),$chr(32) $+ $+(,$chr(91),14, $+ $&
$striphtml.name($read(clanlookup.txt,$calc(%i-1))),,$chr(93),) $+ $chr(32)) $+ $&
$+(12,$striphtml.clan($read(clanlookup.txt,%i)),) $&
}
else {
%clan.output3 = %clan.output3 $+ , $+(12,$striphtml.clan($read(clanlookup.txt,%i)),) $+ $&
$iif(%clan.search == exact,$chr(32),$chr(32) $+ $+(,$chr(91),14, $+ $&
$striphtml.name($read(clanlookup.txt,$calc(%i-1))),,$chr(93),) $+ $chr(32)) $+ $&
$+(12,$striphtml.clan($read(clanlookup.txt,%i)),) $&
}
inc %i $iif(%clan.search == exact,1,2)
}
%clan.display %clan.output $iif(%clan.output2 == $null,[12owwScript])
if (%clan.output2) %clan.display $right(%clan.output2,-1) $iif(%clan.output3 == $null,[12owwScript])
if (%clan.output3) %clan.display $right(%clan.output3,-1) [12owwScript]
clan.cleanup
}
*/
alias clan.output {
var %clan.name.temp $upper($left(%clan.name,1)) $+ $right(%clan.name,-1),%d 1,%clan.name.temp2
while ($gettok(%clan.name.temp,%d,95)) {
%clan.name.temp2 = %clan.name.temp2 $upper($left($gettok(%clan.name.temp,%d,95),1)) $+ $&
$lower($right($gettok(%clan.name.temp,%d,95),-1))
inc %d
}
%clan.name = $replace(%clan.name.temp2,$chr(95),$chr(32))
var %i = 1
var %clan.output = $iif(%clan.search == exact,14 $+ $upper($left(%clan.name,1)) $+ $right(%clan.name,-1) $&
is currently in $+ $iif($read(clanlookup.txt,2) != $null,12 $+ $chr(32) $+ $chr(91) $+ $&
$lines(clanlookup.txt) total clans $+ $chr(93)) $+ :,Results using a partial search for $&
12 $+ $upper($left(%clan.name,1)) $+ $right(%clan.name,-1) $+ $+ $&
$iif($read(clanlookup.txt,2) != $null,14 $+ $chr(32) $+ $chr(91) $+ $lines(clanlookup.txt) $&
total clans $+ $chr(93)) $+ :) $+(12,$striphtml.clan($read(clanlookup.txt,%i)),) $&
14( $striphtml.site($read(clanlookup.txt,%i)) 14)
inc %i
while ($read(clanlookup.txt,%i) != $null) {
if (($len(%clan.output) < 385 && $calc($len(- $+(12,$striphtml.clan($read(clanlookup.txt,%i)),) $&
14- $+ $striphtml.site($read(clanlookup.txt,%i)) $+ 14-) + $len(%clan.output)) < 385)) {
%clan.output = %clan.output $+ , $+(12,$striphtml.clan($read(clanlookup.txt,%i)),) $&
14( $striphtml.site($read(clanlookup.txt,%i)) 14)
}
elseif (($len(%clan.output2) < 385 && $calc($len(- $+(12,$striphtml.clan($read(clanlookup.txt,%i)),) $&
14- $+ $striphtml.site($read(clanlookup.txt,%i)) $+ 14-) + $len(%clan.output2)) < 385)) {
%clan.output2 = %clan.output2 $+ , $+(12,$striphtml.clan($read(clanlookup.txt,%i)),) $&
14( $striphtml.site($read(clanlookup.txt,%i)) 14)
}
elseif (($len(%clan.output3) < 385 && $calc($len(- $+(12,$striphtml.clan($read(clanlookup.txt,%i)),) $&
14- $+ $striphtml.site($read(clanlookup.txt,%i)) $+ 14-) + $len(%clan.output3)) < 385)) {
%clan.output3 = %clan.output3 $+ , $+(12,$striphtml.clan($read(clanlookup.txt,%i)),) $&
14( $striphtml.site($read(clanlookup.txt,%i)) 14)
}
inc %i
}
%clan.display %clan.output $iif(%clan.output2 == $null,[12owwScript])
if (%clan.output2) %clan.display $right(%clan.output2,-1) $iif(%clan.output3 == $null,[12owwScript])
if (%clan.output3) %clan.display $right(%clan.output3,-1) [12owwScript]
clan.cleanup
}
alias clan.cleanup {
.sockclose clanlookup
unset %clan.*
.remove clanlookup.txt
}
on *:SOCKOPEN:clanlookup: {
if ($sockerr) { echo -a $sock($sockname).wsmsg | return }
.set %clan.findings no
.sockwrite -n $sockname POST $+(/clans/search.php?search=,%clan.name,&searchtype=,%clan.search) HTTP/1.1
.sockwrite -n $sockname Host: $+(www.runehead.com,$crlf,$crlf)
}
on *:SOCKREAD:clanlookup: {
if ($sockerr) { echo -a $sock($sockname).wsmsg | return }
.sockread %clan.find
if (%clan.search == exact) {
if (*<p><b>*</b> is currently on the Memberlist(s):</p>* iswm %clan.find) %clan.found = yes
}
else {
if (*<p>The Partial Search result <b>*</b> was found <b>*</b> times:</p>* iswm %clan.find) %clan.found = yes
;if (%clan.nick == $me) {
; if (*<td style='width:140px; border-color:#404040;'><b>*</b></td>* iswm %clan.find) {
; write clanlookup.txt %clan.find
; }
;}
}
if (*<td style='width:90px; border-color:#404040;'><a href='ml.php?clan=*</a></td>* iswm %clan.find) {
write clanlookup.txt %clan.find
}
}
on *:SOCKCLOSE:clanlookup: {
if (%clan.found == no) {
%clan.display $iif(%clan.search == exact,$upper($left(%clan.name,1)) $+ $right(%clan.name,-1) $&
is not in any clans on runehead.com,$upper($left(%clan.name,1)) $+ $right(%clan.name,-1) did $&
not have any partial matches)
clan.cleanup
}
;else { $iif(%clan.nick == $me,clan.output.me,clan.output) }
else { clan.output }
.timerclan.timeout off
.timerclan.timeout2 off
}