Originally Posted By: Wims
-n reads a line but won't read anything if there is not a terminated line in the buffer (a $crlf, or just $lf)
-f force the read of whatever is in the buffer so with -fn, it reads a line in priority, but if no line is found, it will still read whatever is in the buffer, so from that point, you're good, it should read everything.

Now, the on sockread event:
Originally Posted By: /help on sockread
Note: A single /sockread may not be enough to read the entire buffer. You should keep reading until $sockbr (bytes read) is set to zero. This is far faster than letting mIRC re-trigger the event. If your script does not read the whole buffer, the on sockread event is re-triggered if:

a) you were reading into a &binvar.

b) you were reading into a %var and there is still a $crlf terminated line in the buffer waiting to be read.
since you're reading into a binvar, it should always retrigger, it's hard to tell, only debugging the script would help at this point


Also, can you explain what you're doing with this?
Quote:
if ($bvar(&mybinvar,$calc($bvar(&mybinvar,0) - 1),1) == 0) {
.bwrite $script $+ .tmp -1 $calc($bvar(&mybinvar,0) - 2) &mybinvar
.bwrite $script $+ .tmp -1 -1 $crlf
}
else {
.bwrite $script $+ .tmp -1 $bvar(&mybinvar,0) &mybinvar
}

when writing from binvar of sockread performed line-by-line it misses empty lines, so i had to use this trick to make it keep stuff like:
[code]
...

...
[code]
and make it not become:
[code]
...
...
[code]

Thanks again for you help and explanations!

Last edited by Fabius; 29/11/15 04:40 PM.