Instead of
if ($sock(chuck)) sockclose chuck
, you could do:
if (!$sock(chuck))
and then continue what you were doing. After sockread (when the file reaches its end), the sock always closes.
You could also use /sockmark instead of a variable.
So you can replace
set %chuck.msg $iif($mid($1,1,1) == $chr(64),msg #,.notice $nick)
with
sockmark chuck $iif($mid($1,1,1) == $chr(64),msg #,.notice $nick)
and then
%chuck.msg 12[04CHUCK NORRIS12] $replace($htmlfree(%chuck),$quot;,")
with
$sock(chuck).mark 12[04CHUCK NORRIS12] $replace($htmlfree(%chuck),$quot;,")
.
Also:
if ($sockerr) HALT
in the sockopen.
You can't have an error in the socket if you haven't even asked the socket for anything, so you can take that out of the sockopen.
May I inquire what
$mid($1,1,1) == $chr(64)
is?
Otherwise, nice small socket script.
Edit: I've realized that /sockclose may be necessary since the site is running a little slow (for me that is).