napa182 commented on a Page, Random Chuck Norris Fact/Joke  -  Jun 10, 2011

lol @ you using the trigger @nfact
anyways you are getting better at sockets.. ;x
you may want to add in ur description to add this to it's own remote an leave it by it's self, cuz of the way you have ur trigger ie:

on *:text:*:#: {

it will make what ever is in there not work
one more thing if you have my random nick fact socket on a bot that has this in it, it will conflict with it.
Thats cuz the trigger and socket name for that is also called nfact

you should add a bit of flood protect to it as well use sockmark
here is an example:

on $*:text:/^@nfact$/iS:#:nfact
alias nfact {
  if (!%f) { inc -u4 %f
    sockopen nfact www.chucknorrisjokes.linkpress.info 80
    sockmark nfact msg # 12,1 
  }
}
on *:sockopen:nfact: {
  sockwrite -n nfact GET /random-fact.php HTTP/1.1
  sockwrite -n nfact Host: $+($sock(nfact).addr,$str($crlf,2))
}
on *:sockread:nfact: {
  var %nfact | sockread %nfact
  if ($regex(%nfact,/\t{3}<p style.+>(.+?)<\/p>/)) {
    $sock(nfact).mark $regml(1) 
    sockclose nfact
  }
}

5/10 +Like

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.