runescape knowledge base socket

By kerstt on Mar 29, 2007

This searches ur search trigger with [!@.]kba or [!@.]kbase on runescape.com -> knowledge base, u can supply categorys, the script has info when just typing !kba it is 100% custom

alias -l c1 return $+($chr(3),12,$1-,)
alias -l c2 return $+($chr(3),07,$1-,)
alias -l c3 return $+($chr(3),04,$1-,)
on $*:TEXT:/^[!@.](kbase|kba)/Si:#:{
  inc %s
  set $+(%,return.,%s) $iif($left($1,1) == @, msg $chan, notice $nick)
  if ($2- == $null) { %return. [ $+ [ %s ] ] $c1 to search typ !kbase <category> <search> or !kbase <search> categorys are:
    %return. [ $+ [ %s ] ] $c2 -c = $c3 Customer support $c2 -m = $c3 Manual $c2 -n = $c3 News $c2 -r = $c3 Rules of conduct $c2 -s $c3 Safety & security guidelines
  }
  if ($2 == -c) { set %category [ $+ [ %s ] ] 9 | set $+(%,kbase.,%s) $replace($3-,$chr(32),+) | Set %cat [ $+ [ %s ] ] Customer support }
  elseif ($2 == -m) { set %category [ $+ [ %s ] ] 775 | set $+(%,kbase.,%s) $replace($3-,$chr(32),+) | Set %cat [ $+ [ %s ] ] Manual }
  elseif ($2 == -n) { set %category [ $+ [ %s ] ] 852  | set $+(%,kbase.,%s) $replace($3-,$chr(32),+) | Set %cat [ $+ [ %s ] ] News }
  elseif ($2 == -r) { set %category [ $+ [ %s ] ] 823  | set $+(%,kbase.,%s) $replace($3-,$chr(32),+) | Set %cat [ $+ [ %s ] ] Rules of Conduct }
  elseif ($2 == -s) { set %category [ $+ [ %s ] ] 827  | set $+(%,kbase.,%s) $replace($3-,$chr(32),+) | Set %cat [ $+ [ %s ] ] Safety & Security }
  elseif ($2 != -?) { set %category [ $+ [ %s ] ] -1 | set $+(%,kbase.,%s) $replace($2-,$chr(32),+) | Set %cat [ $+ [ %s ] ] None }
  sockopen $+(kbase.,%s) kbase.runescape.com 80
}
on *:SOCKOPEN:kbase.*: {
  var %s = $gettok($sockname,2,46)
  sockwrite -nt $sockname GET $+(/search.ws?category=,$($+(%,category,%s),2),&subcat=-1&submit=Search&q=,$($+(%,kbase.,%s),2)) HTTP/1.1
  sockwrite -nt $sockname Host: kbase.runescape.com $+ $str($crlf,2)
}
on *:SOCKREAD:kbase.*: {
  var %s = $gettok($sockname,2,46)
  if ($sockerr) {
    %return. [ $+ [ %s ] ] Socket error, please report this to $me $+ .
    halt
  }
  var %read
  sockread %read
  if (*Your search for*did not return* iswm %read) {
    %return. [ $+ [ %s ] ] $c2 No results for: $+ $c3 $+ %kbase. [ $+ [ %s ] ] $c2 $+ In category: $+ $c3 $+ %cat [ $+ [ %s ] ] $c1 $+ Try changing ur search $+ $c2 $+ ,check site on $c1 http://kbase.runescape.com/search.ws $c3 $+ OR $c2 $+ check the search tips: $+ $c1 $+ http://kbase.runescape.com/searchtips.ws
    unset $+(%,kbase.*)
    sockclose $+(kbase.,%s)
  }
  if (*<a style="margin-left: 10px"* iswm %read) {
    /tokenize 32 %read
    inc $+(%,kbase.count.,%d)
    set %kba2 [ $+ [ %s ] $+ ] kbase.count. [ $+ [ %d ] ] $remove($24,href=",)
    set %kba [ $+ [ %s ] $+ ] kbase.count. [ $+ [ %d ] ] $htmlfree(%read)
    if ($($+(%,kbase.count.,%d),2) >= 4) {
      %return. [ $+ [ %s ] ] $c1 $+ There were more as $c3 $+ 4 $c2 results for The search: $+ $c3 $+ %kbase. [ $+ [ %s ] ] $c2 $+ In category: $+ $c3 $+ %cat [ $+ [ %s ] ] $+ $c2 $+ , script halts.
      unset $+(%,kbase.*)
      sockclose $+(kbase.,%s)
    }
    else {
      %return. [ $+ [ %s ] ] $c2 Search results for: $+ $c3 $+ %kbase. [ $+ [ %s ] ] $c2 $+ In category: $+ $c3 $+ %cat [ $+ [ %s ] ] $c2 $+ Are: $+ $c1 %kba [ $+ [ %s ] $+ ] kbase.count. [ $+ [ %d ] ] the URL can be found here: $+ $c2 $+ http://kbase.runescape.com/ $+ $replace(%kba2 [ $+ [ %s ] $+ ] kbase.count. [ $+ [ %d ] ] ,">, $c3 $chr(32) Category:)
    }
  }
  if (</html> isin %read) {
    unset $+(%,kbase.*)
    sockclose $+(kbase.,%s)
    /unset %d
    /unset $+(%,kbase.*)
  }
}
alias htmlfree { var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;) | return %x 
}

Comments

Sign in to comment.
kerstt   -  Apr 18, 2007

Yes, it doesnt exist anymore though.

 Respond  
F*U*R*B*Y*   -  Apr 12, 2007

ThunderBot*

 Respond  
F*U*R*B*Y*   -  Apr 12, 2007

kerstt, you the creator of ThudnerBot? :P

 Respond  
kerstt   -  Apr 06, 2007

that has to be cause o an other script cause i dont use the var %rs.skill anywhere

 Respond  
krh593   -  Apr 03, 2007

Tried putting this in and typed !KBa to test and now i\'m repeatedly getting this error;
(19:27:07) 12 error: unknown command 02(12%RS.SKILL.1

Can\'t join any channels or do anything without it saying that

 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.