All pastes #69241 Raw Edit

Mine

public text v1 · immutable
#69241 ·published 2006-06-22 18:15 UTC
rendered paste body
on *:TEXT:!clans*:#o_ok:{
  if (%clan.used == 1) { .notice $nick The clan lookup is being used by %clan.nick $+ . Try again in 30-60 seconds %logo }
  else {
    set %clan.name $replace($2-,$chr(32),$chr(95))
    if ($len(%clan.name) > 12) { 
      msg $chan Name cannot be longer than 12 characters 
      unset %clan.*
    }
    else { 
      .notice $nick Processing request... please wait about 1 minute for the Runehead server to respond
      set %clan.nick $nick
      set %clan.chan $chan
      set %clan.used 1 
      set %clan.integer 1
      set %clan.found no
      clan.chk
    } 
  }
}

alias clans {
  if (%clan.used == 1) { echo -a The clan lookup is being used by %clan.nick $+ . Try again in 15-20 seconds %logo }
  else {
    set %clan.name $replace($1-,$chr(32),$chr(95))
    if ($len(%clan.name) > 12) { 
      echo -a $chan Name cannot be longer than 12 characters 
      unset %clan.*
    }
    else { 
      msg $active !clans $1-
      set %clan.nick $me
      set %clan.chan $active
      set %clan.used 1 
      set %clan.integer 1
      set %clan.found no
      clan.chk
    } 
  }
}

alias clan.chk {
  .sockclose clanlookup
  .sockopen clanlookup www.runehead.com 80
}

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 clan.output {
  if (%clan.found.clan.2) {
    var %i = 1
    :clanvar
    if (%clan.found.clan. $+ %i == $null) { goto msg }
    var %clans.all.clans. $+ %i = %clan.found.clan. $+ %i = 14( $+ %clan.found.ml. $+ %i $+ 14) $chr(32)
    inc %i
    goto clanvar
    while (%clan.found.clan. $+ %i != $null) {
      %allclans = %allclans $+ $chr(44) %clan.found.clan. $+ %i 14( $+ %clan.found.ml. $+ %i $+ 14) $+ $chr(32)
      echo -a %clan.found.clan. %+ %i
      inc %i
    }
    :msg
    $iif($1 == msg,msg %clan.chan,notice %clan.nick) $upper($left(%clan.name,1)) $+ $right(%clan.name,-1) is in the following clans:12 %clan.allclans.1 %clans.allclans.2 %clan.allclans.3 $+ [12owwScript]
  }
  else { $iif($1 == msg,msg %clan.chan,notice %clan.nick) $upper($left(%clan.name,1)) $+ $right(%clan.name,-1) is in %clan.found.clan.1 14( $+ %clan.found.ml.1 $+ 14) [12owwScript] }
  unset %clan.*
}


on *:SOCKOPEN:clanlookup: {
  if ($sockerr) { echo -a $sock(clanlookup).wsmsg | return }
  .set %clan.findings no
  .sockwrite -n clanlookup POST /clans/search.php?search= $+ %clan.name $+ &searchtype=exact HTTP/1.1
  .sockwrite -n clanlookup Host: $+(www.runehead.com,$crlf,$crlf)
}
on *:SOCKREAD:clanlookup: {
  if ($sockerr) { echo -a $sock(clanlookup).wsmsg | return }
  var %clan.integer 1
  .sockread %clan.find
  if (*<p><b>*</b> is currently on the Memberlist(s):</p>* iswm %clan.find) %clan.found = yes
  :clanloop  
  if ($striphtml.clan(%clan.find) iswm %clan.found.clan.* ) { return }
  if (*<td style='width:90px; border-color:#404040;'><a href='ml.php?clan=*</a></td>* iswm %clan.find) {
    set %clan.found.clan. $+ %clan.integer $striphtml.clan(%clan.find)
    set %clan.found.ml. $+ %clan.integer $striphtml.site(%clan.find) 
    inc %clan.integer
    goto clanloop
  }
}
on *:SOCKCLOSE:clanlookup: {
  if (%clan.found == no) { msg %clan.chan $upper($left(%clan.name,1)) $+ $right(%clan.name,-1) is not in any clans on runehead.com | unset %clan.* }
  elseif (%clan.nick isop $chan || $clan.nick ishop $chan || %clan.nick == $me) { clan.output msg }
  else clan.output notice
}