sunslayer commented on a Page, 8ball (IMPORVED) + dialog and extra  -  Oct 24, 2009

the /'s arent needed but im glad to see that its different from all other of the 30-40 some 8ball scripts on here

another approach could be using a socket to get many more possibilities

alias 8ball {
  sockopen 8ball web.ics.purdue.edu 80
  sockmark 8ball $replace($1-,$chr(32),_)
}
on *:sockopen:8ball: {
  sockwrite -n $sockname GET $+(/~ssanty/cgi-bin/eightball.cgi?question=,$sock($sockname).mark)  HTTP/1.1
  sockwrite -n $sockname HOST: web.ics.purdue.edu $+ $crlf $+ $crlf
}
on *:sockread:8ball: {
  var %a | sockread %a 
  if ($regex(%a,/<center><h1>Magic Eight Ball</h1> <hr /> <img src="/~ssanty/images/\d.gif" alt="(.*?)" /> <hr /> Question:/i)) {
    echo -a $replace($sock($sockname).mark,_,$chr(32)) $+ : $regml(1)
  }
}

that site doesnt have that many responses but its just an example

 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.