All pastes #252393 Raw Edit

Anonymous

public text v1 · immutable
#252393 ·published 2006-11-19 13:14 UTC
rendered paste body
on *:TEXT:!price*:#: {
  if (%price.busy != $null) { .notice $nick Sorry but $nick is already using this command... please wait 3 seconds and try again. | halt }
  set %itemlol $2-
  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 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(5 $+ %itemname $+ :1 %price,</td>)
  if (spelling isin $read(pricedownload.txt,1)) { notice %pricenick 5Your search 2did not5 return any results. Please make sure your 2spelling5 is correct and that you are typing 2full words5. | halt  }
  var %output $remove(%output,http://www.zybez.net -->)
  var %output $remove(%output,tom">Zybez is screwing up our parser because we don't credit them. ^_^:)
  var %output $remove(%output,:)
  if (%output != *gp) {
    var %output Sorry, Zybez is currently Screwing up their parser because 'apparently' we dont give them credit.
  }
  if (%msg.type == private) { notice %pricenick 2 $+ %itemlol $+ :5 %output }  
  elseif (%msg.type == public) { msg %pricechannel 2 $+ %itemlol $+ :5 %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
    } 
    if (*class="tablebottom"* iswm %temp) && (*http://* !iswm %temp) { 
      write pricedownload.txt %temp
      /.timerSOCKET 1 2 sockclose price
    } 
  }
}
on *:sockclose:price:{
  pricemsg
}