All pastes #285129 Raw Edit

my first sock script

public text v1 · immutable
#285129 ·published 2006-12-19 17:09 UTC
rendered paste body
on *:text:!rsplayers*:#: {
  if ($sock(rsplayerssock)) .sockclose rsplayerssock
  set %chan $chan
  set %nick $nick
  sockopen rsplayerssock www.runescape.com 80
}
on *:SOCKOPEN:rsplayerssock: {
  sockwrite -nt $sockname GET / HTTP/1.1
  sockwrite -nt $sockname Host: www.runescape.com
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:rsplayerssock: {
  if ($sockerr) {
    msg %chan Socket Error: $sockname $+ . Error code: $sockerr Please inform $me of this error message.
    halt
  }
  else {
    var %sockreader
    sockread %sockreader
    if (*currently*players* iswm %sockreader ) {
      set %rsplayers
      notice %nick the is currently %rsplayers people playing runescape right now
      unset %chan
      unset %nick
      sockclose rsplayerssock
    }
  }
}