on $*:TEXT:/^[!@.~]price/Si:#:{
if (!$2) halt
else {
var %n = $ticks
set $+(%,price.item.,%n) $replace($2-,$chr(32),+)
set $+(%,price.style.,%n) $iif($left($1,1) == @,msg $chan)
sockopen $+(price.,%n) www.zybez.net 80
}
}
on *:SOCKOPEN:price.*:{
var %id = $gettok($sockname,2,46)
sockwrite -n $sockname GET /priceguide.php?search_terms= $+ $($+(%,price.item.,%id),2) $+ &search_area=1&price_low=&price_high=&member=1 HTTP/1.1
sockwrite -n $sockname Host: www.zybez.net
sockwrite -n $sockname $+($crlf,$crlf)
}
on *:SOCKREAD:price.*:{
var %id = $gettok($sockname,2,46)
var %item = $replace($($+(%,price.item.,%id),2),+,$chr(32)), $&
%style = $($+(%,price.style.,%id),2)
if ($sockerr) {
%style An error occured while connecting. Please contact rune4234.
unset $+(%,price.*)
sockclose $+(price.,%id)
}
else {
var %read
sockread %read
if (<td class="tablebottom" colspan="5">Your search did not return any results. Please make sure your spelling is correct and that you are typing full words.</td> isin %read) {
%style No results were found for " $+ %item $+ "
unset $+(%,price.*)
sockclose $+(price.,%id)
}
if (<!--name--><td class='tablebottom'>*</td> iswm %read) {
tokenize 32 $nohtml(%read)
set $+(%,price.name.,%id) $1-
}
if (<!--price--><td class="tablebottom">*</td> iswm %read) {
tokenize 32 $nohtml(%read)
set $+(%,price.price.,%id) $1-
}
if (<td class="tablebottom"><a href="/priceguide.php?category=*">*</a></td> iswm %read) {
tokenize 32 $nohtml(%read)
var %cat = $replace($1-,&,+)
inc $+(%,price.times.,%id)
if ($($+(%,price.times.,%id),2) > 5) {
%style Max results of 5 allowed. Try making your search for " $+ %item $+ " more specific.
unset $+(%,price.*)
sockclose $+(price.,%id)
}
else {
%style Item - $($+(%,price.name.,%id),2) $&
Price - $($+(%,price.price.,%id),2) $&
Category - %cat
unset $+(%,price.name.,%id)
unset $+(%,price.price.,%id)
}
}
if (</html> isin %read) {
unset $+(%,price.*)
sockclose $+(%,price.,%id)
}
}
}