All pastes #223537 Raw Edit

Miscellany

public text v1 · immutable
#223537 ·published 2006-10-26 23:41 UTC
rendered paste body
on *:TEXT:.price*:#: {
  if (%price.busy != $null) { .notice $nick 3[14Price Guide3] Sorry but $nick is already using this command... please wait 3 seconds and try again. | halt }
  set -u3 %price.busy $nick
  write -c pricedownload.txt
  set %pricenick $nick
  set %msg.type private
  set %rs.item $replace($2-,$chr(32),$chr(43))
  /price
}
on *:TEXT:.pprice*:#: {
  if (%price.busy != $null) { .notice $nick 3[14Price Guide3] Sorry but $nick is already using this command... please wait 3 seconds and try again. | halt }
  set -u3 %price.busy $nick
  write -c pricedownload.txt
  set %pricechannel $chan
  set %pricenick $nick
  set %msg.type public
  set %rs.item $replace($2-,$chr(32),$chr(43))
  /price
}
alias pricemsg {
  var %itemname $right($read(pricedownload.txt,2),-24)
  var %price $right($read(pricedownload.txt,3),-24)
  var %output $remove(14 $+ %itemname $+ :07 %price,</td>)
  if (spelling isin $read(pricedownload.txt,1)) { notice %pricenick 07Your search did not return any results. Please make sure your spelling is correct and that you are typing full words. | halt  }
  if (%msg.type == private) { notice %pricenick 3[14Price Guide3] %output }  
  elseif (%msg.type == public) { msg %pricechannel 3[14Price Guide3] %output }
  else { msg %pricechannel Error }
}
alias price sockclose price | sockopen price zybez.net 80
on *:sockopen:price:{ 
  sockwrite -n $sockname GET /priceguide.php?search_terms= $+ %rs.item $+ &search_area=1&price_low=&price_high=&member=1 HTTP/1.1 
  sockwrite -n $sockname Host: zybez.net $+ $crlf $+ $crlf
}
on *:sockread:price:{ 
  if ($sockerr) {
    echo -a Error.
    halt
  }
  else {
    sockread %temp 
    if (*class="tablebottom"* iswm %temp) { 
      write pricedownload.txt %temp
      .timerSOCKET 1 2 sockclose price
    } 
  }
}
on *:sockclose:price:{
  pricemsg
}