The on sockread code below is based on code from the mirc
help file. We can see that it assigns the '-' character to
the %temp variable if it encounters a null string. However my
code generates some errors when writing the %temp variable to
the @myweather custom window.
The nature of the error confuses me. I cannot figure how there
can be an essentially empty value for %temp after passing thru
error checking for $Null.
Advice humbly welcomed.
alias myweather {
window -h @myweather | clear @myweather
%site = www.bom.gov.au
%page = /products/IDV60900.shtml
sockclose myweather
sockopen myweather %site 80
}
on *:sockopen:myweather: {
echo -a connected to %site
sockwrite -n $sockname GET %page HTTP/1.0
sockwrite -n $sockname Host: %site
sockwrite -n $sockname $crlf
}
on *:sockread:myweather: {
if ($sockerr > 0) return
:nextread
inc %linecount
sockread %temp
if ($sockbr == 0) return
if (%temp == $null) %temp = -
; the next line of code gives this error 4 times
; "/aline: insufficient parameters (line 26, myweather.mrc)"
aline -p @myweather %temp
;aline -p @myweather %temp $chr(160) <------------------ gives an error free result
goto nextread
}
on *:sockclose:myweather: {
window -a @myweather
}