Clan info

By [-sophie-] on Jan 15, 2008

Pretty much for RuneScape, using socket to retrieve information on a clan that you've specified. If you specify a clan initial name it will return it's real name also.
Enjoy.

alias -l c2 return $+($chr(3),02,$1-,$chr(3)) 
alias -l c7 return $+($chr(3),07,$1-,$chr(3)) 
alias -l error return $+($chr(3),2**[07ERROR02]**,$1-,$chr(3)) 
alias -l clan return $+($chr(3),2**[07CLAN INFO02]**,$1-,$chr(3)) 

on $*:TEXT:/^[!@]claninfo/Si:#:{ 
  var %r = $r(1,99999) 
  set $+(%,way,%r) $iif($left($1,1) == @,msg $chan,notice $nick) 
  if (!$2) { /notice $nick $error() $c2(You have) $c7(not) $c2(specified any) $c7(clan) $c2(to look up.) } 
  else { 
    set $+(%,clan,%r) $replace($2-,$chr(32),$chr(95)) 
    sockopen ClanInfo. [ $+ [ %r ] ] www.runehead.com 80 
  } 
} 
on *:SOCKOPEN:ClanInfo.*: { 
  var %r = $gettok($sockname,2,$asc(.)) 
  sockwrite -nt $sockname GET $+(/feeds/lowtech/searchclan.php?search=,$(,$+(%,clan,%r))) HTTP/1.1 
  sockwrite -nt $sockname Host: www.runehead.com 
  sockwrite -nt $sockname $crlf 
} 
on *:SOCKREAD:ClanInfo.*: { 
  var %r = $gettok($sockname,2,$asc(.)) 
  if ($sockerr) { //echo -t $error $c2(Socket error:) $c7($sockerr) | $(,$+(%,way,%r)) $error $+($c2(There was a) $c7(problem),$c2($chr(44) please try again) $c7(later),$c2($chr(46))) 
    cleanup %r 
  } 
  else { 
    var %ClanInfo 
    sockread %ClanInfo 
    if (*Not Found* iswm %ClanInfo) { $(,$+(%,way,%r)) $clan $+($c2("),$c7($gettok($(,$+(%,clan,%r)),1-,95)),$c2(" was not) $c7(found),$c2($chr(46))) 
      cleanup %r 
    } 
    else { 
      if (*http://* iswm %ClanInfo) { 
        tokenize 32 %ClanInfo 
        set $+(%,text,%r) $1- 
        if (*clan|* iswm %ClanInfo) { 
          $(,$+(%,way,%r)) $clan $+($c2("),$c7($gettok($(,$+(%,text,%r)),1,124)),$c2(")) $c2(Members:) $c7($gettok($(,$+(%,text,%r)),6,124)) $c2(Avg Cmb:) $c7($gettok($(,$+(%,text,%r)),7,124)) $c2(Type:) $c7($gettok($(,$+(%,text,%r)),12,124)) $c2(Initial:) $c7($gettok($(,$+(%,text,%r)),5,124)) $c2(Cape:) $c7($gettok($(,$+(%,text,%r)),14,124))
          $(,$+(%,way,%r)) $c2(Forums URL:) $c7($gettok($(,$+(,%,text,%r)),2,124)) $c2(Memberlist URL:) $c7(http://www.runehead.com/clans/ml.php?clan= $+ $c7($remove($gettok($(,$+(%,text,%r)),3,124),http://rshsc.net/ml.php?clan=)))
          cleanup %r 
          sockclose $sockname 
        } 
      } 
    } 
  } 
} 
alias -l cleanup { 
  unset %way [ $+ [ $1 ] ] 
  unset %clan [ $+ [ $1 ] ] 
  unset %text [ $+ [ $1 ] ] 
} 

Comments

Sign in to comment.
WillK1llin   -  Jan 02, 2009

remote right?

 Respond  
[-sophie-]   -  Jan 15, 2008

Feel free to share your opinions on what I could improve :)

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.