All pastes #332939 Raw Edit

Someone

public text v1 · immutable
#332939 ·published 2007-01-30 15:06 UTC
rendered paste body
on $*:TEXT:/^[!@]stats */Si:*: {
;set the variables, (i assume you understand this part)
  set %stat.target $2- 
  set %stat.return $iif($left($1,1) == @,msg $chan,notice $nick)
  if ($len($2-) > 12) { %stat.return 4runescape 14nicknames can only contain up to4 12 14letters. | halt }
;now here i use the /sockopen command, statlook i the name of the socket, 80 is the portal http://
  else { sockopen statlook www.slushpuppy.silverinterlocution.org 80 }
}
;in the sockopen event you may change the direct link, and as you can see i also adds something to the link ( %stat.target)
on *:SOCKOPEN:statlook*:{ 
  sockwrite -nt $sockname GET /rsstats.php?stats= $+ %stat.target HTTP/1.1
  sockwrite -nt $sockname Host: www.slushpuppy.silverinterlocution.org $+ $crlf $+ $crlf 
} 
;sockread is the event that reads the file source
;in this case the source file is very little
on *:SOCKREAD:statlook*:{ 
;if an error apears it will send the message "error" to the active window;
  if ($sockerr) { 
    echo -a Error. 
    halt 
  } 
  else { 
;%stat.html contains the source file;
    var %stat.html 
    sockread %stat.html
;%stat.return sends the messages the source file.
;$htmlfree() is a custom idenfifier (see buttom) 
  %stat.return $htmlfree(%stat.return)
;then we unset the variables and sockclose the socket, 
;$sockname is an identifier for the sockets name
      unset %stat.*
      sockclose $sockname
      halt 
    } 
  } 
} 
;this custom identifier removes all html from a variable, or text;
alias -l htmlfree { 
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, ) 
  return %x 
}