rendered paste bodyon $*:TEXT:/^[!@.]shop/Si:#:{
if (!$2) {
notice $nick *** [ Shop ]: You must supply a shop item
}
else {
inc %n
set $+(%,shop.style.,%n) $iif($left($1,1) == @,msg $chan,notice $nick) 14*** 7[ Shop ]:14
set $+(%,shop.word.,%n) $replace($2-,$chr(32),+)
set $+(%,shop.nick.,%n) $nick
sockopen $+(shop.,%n) www.zybez.net 80
}
}
on *:SOCKOPEN:shop.*:{
var %id = $gettok($sockname,2,46)
sockwrite -n $sockname GET /shops.php?search_area=itemsearch&search_term= $+ $($+(%,shop.word.,%id),2) HTTP/1.1
sockwrite -n $sockname Host: www.zybez.net
sockwrite -n $sockname $+($crlf,$crlf)
}
on *:SOCKREAD:shop.*:{
var %id = $gettok($sockname,2,46)
var %style = $($+(%,shop.style.,%id),2), $&
%word = $($+(%,shop.word.,%id),2), $&
%nick = $($+(%,shop.nick.,%id),2)
if ($sockerr) {
%style An error occured while connecting
unset $+(%,shop.*)
sockclose $+(shop.,%id)
}
else {
var %read
sockread %read
if (*Sorry, no entries match your search criteria* iswm %read) {
%style No results found for " $+ %word $+ "
unset $+(%,shop.*)
sockclose $+(shop.,%id)
}
if (*<td class="tablebottom">*</td>* iswm %read) {
tokenize 32 $nohtml(%read)
if (!$($+(%,shop.item.,%id),2)) {
set $+(%,shop.item.,%id) $1-
halt
}
elseif (!$($+(%,shop.price.,%id),2)) {
set $+(%,shop.price.,%id) $1-
halt
}
elseif (!$($+(%,shop.stock.,%id),2)) {
set $+(%,shop.stock.,%id) $1-
halt
}
elseif (!$($+(%,shop.shop.,%id),2)) {
set $+(%,shop.shop.,%id) $1-
%style 14Item: $($+(%,shop.item.,%id),2) 7Price: $($+(%,shop.price.,%id),2) 14Stock: $($+(%,shop.stock.,%id),2) 7Shop: $($+(%,shop.shop.,%id),2)
unset $+(%,shop.*)
sockclose $+(shop.,%id)
}
}
if (</html> isin %read) {
unset $+(%,shop.*)
sockclose $+(shop.,%id)
}
}
}