mIRC Home    About    Download    Register    News    Help

Print Thread
#216316 09/11/09 12:57 AM
Joined: Feb 2003
Posts: 106
L
Vogon poet
OP Offline
Vogon poet
L
Joined: Feb 2003
Posts: 106
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.

Code:
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
} 


-
Just because it never happened doesn't mean it isn't true.
Joined: Jul 2006
Posts: 4,152
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,152
Quote:
aline -p @myweather %temp
;aline -p @myweather %temp $chr(160) <------------------ gives an error free result
This kind of error means data only contain spaces, because mIRC uses spaces to delimitate parameters.
That's why the addition of a $chr(160) (or any other character, but a space) can correct the error : it make another parameter


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #216319 09/11/09 03:36 AM
Joined: Feb 2003
Posts: 106
L
Vogon poet
OP Offline
Vogon poet
L
Joined: Feb 2003
Posts: 106
Thank you, Wim


-
Just because it never happened doesn't mean it isn't true.

Link Copied to Clipboard