it almost looks like you are useing some messed up socket maker to make these. =/
no need for all them vars an whatnot you could have just done this
on $*:text:/^@fact$/iS:#: {
if ($sock(fact)) sockclose fact
sockopen fact www.randomfunfacts.com 80
sockmark fact msg #
}
on *:sockopen:fact: {
sockwrite -nt $sockname GET / HTTP/1.1
sockwrite -nt $sockname Host: $+($sock(fact).addr,$str($crlf,2))
}
on *:sockread:fact: {
var %fact | sockread %fact
if ($regex(%fact,/<i>(.+)<\/i>/)) {
$sock(fact).mark $regml(1)
sockclose fact
}
}