What The Fuck Should I Make For Dinner?
Platform: mIRC
Published Oct 28, 2011
Updated Oct 31, 2011
This is a quick socket snippet to the site
http://!@#$.com, a site that offers a php script that randomly picks a dish and generates a recipe link for you, along with a witty message.
Usage: !dinner
(01:32:24 pm) <~hxck> !dinner
(01:32:26 pm) <~Victoria> Cook up some !@#$: Marinated Grilled Beef Hearts
(01:32:26 pm) <~Victoria>
http://www.cookstr.com/recipes/marinated-grilled-beef-hearts
Place this snippet in a NEW remote! This script asks you whether or not you're a vegetarian in when you load it. If you are, click yes, and the snippet will grab recipes from veg.php for you. Enjoy!
on *:LOAD: set %tfm $?!"Are you a Vegetarian?"
on $*:TEXT:/^!dinner$/Si:#: {
$iif(%tfm == $true,set %wtfm veg.php,set %wtfm index.php)
sockopen wtf !@#$.com 80
sockmark wtf msg #
}
on *:SOCKOPEN:wtf: {
sockwrite -n $sockname GET / $+ %wtfm HTTP/1.1
sockwrite -n $sockname Host: !@#$.com
sockwrite -n $sockname Connection: close
sockwrite -n $sockname $crlf
}
on *:SOCKREAD:wtf: {
if ($sockerr) { $sock(wtf).mark Socket Error: $sock(wtf).wsmsg }
var %wtftemp
sockread %wtftemp
if (!@#$ isin %wtftemp) { inc %x }
if (%tfm == $false) {
if (%x == 2) { set %wtfline $remove(%wtftemp,</dl>) | inc %x }
}
if (%tfm == $true) {
if (%x == 1) { set %wtfline $remove(%wtftemp,</dl>) | inc %x }
}
if (<dt><a href=" isin %wtftemp) {
set %wtfdesc $replace($nohtml(%wtftemp),’,',”,")
set %wtflink $remove($gettok(%wtftemp,2,32),href=",")
}
}
on *:SOCKCLOSE:wtf: {
$sock(wtf).mark %wtfline $+ : %wtfdesc
$sock(wtf).mark %wtflink
unset %x
}
alias -l nohtml return $regsubex($1-,/(?:^[^>]+>)|(?:<[^>]+(?:>|$))/g,)