I am a new to Mirc scripting, but not programming. I am trying to read a webpage using sockets from within mirc and take the the html returned line by line and use regex to parse out the info i want. The script works, sort of :s It gives me a "0 Unknown command" or "1 Unknown command" error messages (tons of them) . And it is not overwriting my hash table, just appending or overwriting the individual entries. If i take the regex command out, i don't get the unknown command error message. But i get the info i want :s
alias checktop {
sockopen ladder xwis.net 80
}
on *:sockread:ladder:{
if ($sockerr > 0) {
return
}
:nextread
sockread %temp
if ($sockbr == 0) return
if (%temp == $null) {
%temp = -
}
$regex( %temp , <b>(\w+) )
set %test $regml(0)
if ( %test != %azero ) {
inc %count
set %playname $regml(1)
echo -a %playname %count
}
$regex(%temp,(\d+)\sPoints)
%test = $regml(0)
%azero = 0
if ( %test != %azero ) {
set %playpoint $regml(1)
set %addit Rank %count Points %playpoint
echo -a %addit
hadd -m top50 %playname %addit
hsave -o top50 testit.txt
}
goto nextread
}
on *:sockopen:ladder:{
sockwrite -n $sockname GET /xcl/ra2/ HTTP/1.1
sockwrite -n $sockname Host: xwis.net $+ $crlf $+ $crlf
}
on *:SOCKCLOSE:ladder: {
echo -s *** $sockname just closed
}
alias gettop {
set %playname ""
set %playpoint ""
set %azero 0
set %count 0
checktop
; hfree top50
chklist
; :error
; echo -a $error
}
alias chklist {
if (!$hget(top50,0).item) { msg $nick No data
![blush blush](/images/graemlins/mirc/blush.gif)
}
else {
%i = 1
while (%i <= $hget(top50,0).item) {
%Item = $hget(top50,%i).item
%reason = $hget(top50,%Item)
echo -a %Item - %reason
inc %i
}
}
i do a call to gettop and it loops and displays the info in the right order, then spits out a whole bunch of unknown command errors - it doesn't seem to be processing in a linear fashion either - when i am reading thru the html, it displays the output - the hash file entries are essentially correct. It displays the output from chklist first tho, then parses the html - but the command is after it :s Any help or light you can shed here would be so much appreciated
![laugh laugh](/images/graemlins/mirc/laugh.gif)