alias cjlookup { /sockclose clanjag | /set %cjlookup $1 | /set %cjnick $2 | /sockopen clanjag clanjaguar.com 80 } alias cjlookup2 { if ($1 == st) /set %lookstat overall if ($1 == att) /set %lookstat attack if ($1 == def) /set %lookstat defence if ($1 == str) /set %lookstat strength if ($1 == hp) /set %lookstat hitpoints if ($1 == range) /set %lookstat ranged if ($1 == pray) /set %lookstat prayer if ($1 == mage) /set %lookstat magic if ($1 == cook) /set %lookstat cooking if ($1 == wc) /set %lookstat woodcutting if ($1 == fletch) /set %lookstat fletching if ($1 == fish) /set %lookstat fishing if ($1 == fm) /set %lookstat firemaking if ($1 == craft) /set %lookstat crafting if ($1 == smith) /set %lookstat smithing if ($1 == mine) /set %lookstat mining if ($1 == herb) /set %lookstat herblore if ($1 == agil) /set %lookstat agility if ($1 == thieve) /set %lookstat thieving if ($1 == slay) /set %lookstat slayer if ($1 == farm) /set %lookstat farming if ($1 == rc) /set %lookstat runecraft if ($1 == hunt) /set %lookstat hunter if ($1 == con) /set %lookstat construction if ($1 == cmbmelee) /set %lookstat cmbmelee if ($1 == cmbmagic) /set %lookstat cmbmagic if ($1 == cmbrange) /set %lookstat cmbrange } on *:INPUT:*: { if ($1 == !cj || $1 == .cj || $1 == @cj) { if ($2) { %lookstat = lookall if ($1 == @cj) %lookstatpub = $chan else %lookstatpub = false /cjlookup2 $2 if (%lookstat == lookall) /cjlookup $replace($2-,$chr(32),$chr(45)) else /cjlookup $replace($3,$chr(32),$chr(45)) } } ; if ($1 == @cj) { ; %lookstat = none ; %lookstatpub = $chan ; /cjlookup2 $2 ; if (%lookstat == none) /notice $nick $2 isn't a skill! Syntax: @cj ; else /cjlookup $replace($3,$chr(32),$chr(45)) ; } } on *:TEXT:*:#: { if ($1 == !cj || $1 == .cj) { if ($2) { %lookstat = lookall %lookstatpub = false /cjlookup2 $2 if (%lookstat == lookall) /cjlookup $replace($2-,$chr(32),$chr(45)) $nick else /cjlookup $replace($3,$chr(32),$chr(45)) $nick } } if ($1 == @cj) { %lookstat = none %lookstatpub = $chan /cjlookup2 $2 if (%lookstat == none) /notice $nick $2 isn't a skill! Syntax: @cj else /cjlookup $replace($3,$chr(32),$chr(45)) } } on *:TEXT:*:?: { if ($1 == !cj || $1 == .cj) { if ($2) { %lookstat = lookall %lookstatpub = false /cjlookup2 $2 if (%lookstat == lookall) /cjlookup $replace($2-,$chr(32),$chr(45)) $nick else /cjlookup $replace($3,$chr(32),$chr(45)) $nick } } } on *:sockopen:clanjag:{ /sockwrite -n $sockname GET /bot/rank.php?name= $+ %cjlookup HTTP/1.1 /sockwrite -n $sockname Host: clanjaguar.com $+ $crlf $+ $crlf /echo looking up %cjlookup for %lookstat } on *:sockread:clanjag:{ if ($sockerr) { echo -a Error. /halt } /sockread %temp if (%cjnick == $null) /set %cjnick stinkynate if (Profile isin %temp) { %i = 3 /set %cjlookup $gettok(%temp,%i,32) /inc %i while ($gettok(%temp,%i,32) != with) { %cjlookup = %cjlookup $gettok(%temp,%i,32) /inc %i } } elseif (Err0r isin %temp) { /notice %cjnick %cjlookup not found in database. /halt } if (%lookstat != lookall) { if (%lookstat == $gettok(%temp,4,39)) { /set %lookedup $htmlfree($gettok(%temp,3,32)) if (%lookedup != $null && %lookedup != user) { if (%lookstatpub == false) /notice %cjnick %cjlookup $+ 's %lookstat CJ rank is %lookedup else /msg %lookstatpub 14 $+ %cjlookup $+ 's %lookstat CJ rank is 07 $+ %lookedup } elseif (%lookedup == user) /notice %cjnick %cjlookup does not appear in %lookstat highscores. ; else /notice %cjnick 4Error | /halt ; elseif (%looktry == 0) /inc %looktry | /cjlookup %cjlookup %cjnick ; else halt } } else { if (overall isin %temp) { /set %i true /set %lookout2 14Clan Jaguar Ranks for 7 $+ %cjlookup --- /set %looktotal 0 /set %looknum 0 } if (%i == true) { /set %lookout $gettok(%temp,4,39) /set %lookedup $htmlfree($gettok(%temp,3,32)) if (%lookedup && %lookedup != user) { %lookout2 = %lookout2 $+ 14 %lookout $+ :7 %lookedup | %looktotal = $calc(%looktotal + %lookedup) | /inc %looknum } } if (crafting isin %temp) { /set %lookout3 %lookout2 /set %lookout2 } if (cmbrange isin %temp) { %i = false %lookout2 = %lookout2 14(Average CJ Rank: 07 $+ $calc(%looktotal / %looknum) $+ ) if (%lookstatpub) { /msg %lookstatpub %lookout3 /msg %lookstatpub %lookout2 } else { /notice %cjnick %lookout3 /notice %cjnick %lookout2 /unset %lookout /unset %lookout2 /unset %lookout3 /unset %lookedup /unset %lookstat /unset %looktotal /unset %looknum /unset %lookstatpub } } } /unset %temp ; /unset %cjlookup ; /unset %cjnick } alias -l htmlfree { ; It's local because it won't be used by the command line, only this file. ; Local aliases avoid conflicting names. var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, ) return %x }