All pastes #369614 Raw Edit

Untitled

public text v1 · immutable
#369614 ·published 2007-02-23 23:08 UTC
rendered paste body
On $*:Text:/^[!@.]Price */Si:#:{
  if ($me != Wsm2525) {
    if (!$2) {
      notice $nick No item entered.
    }
    else {
      if ($me != Wsm2525) {
        var %x = 1
        while ($sock($+(Price.,%x))) {
          inc %x
        }
        set $+(%,price.target,.,%x) $iif($left($1,1) == @,msg $chan, notice $nick)
        set $+(%,price.search,.,%x) $replace($2-,$chr(32),+)
        sockopen $+(Price,.,%x) slushpuppy.silverinterlocution.org 80
      }
    }
  }
}
On *:SockOpen:Price.*:{
  var %id = $right($sockname,-6)
  sockwrite -nt $sockname GET /price.php?price= $+ $eval($+(%,price.search,.,%id),2) HTTP/1.0
  sockwrite -nt $sockname Host: slushpuppy.silverinterlocution.org $+ $crlf $+ $crlf
}
On *:SockRead:Price.*:{
  var %id = $right($sockname,-6)
  var %target = $eval($+(%,price.target,.,%id),2)
  if ($sockerr) {
    %target A socket error has occured, please try again later.
    cleanup %id
  }
  else {
    var %read
    var %matches 
    while (1) {
      sockread %read
      if (!$sockbr) { 
        break
      }
      if (*gp* iswm %read) {
        tokenize 32 %read
        inc %matches  
        var %results = %results $iif(%results,$col1($+($chr(2),$chr(124),$chr(2))),$chr(32)) $col2($deltok($remove($1-,<br>),1,32))
      }
    }
    if (!%matches) {
      %target $col1(No Results found.)
    }
    else { 
      %target $col1(Returning) $col2(%matches) $col1(Results:)
      %target $right(%results,-1) 
    }    
    sockclose $sockname
    cleanup %id
  }
}
;;Replace 02 with your first desired color.;;
alias -l col1 {
  return $+($chr(3),9,$1-,$chr(3)) 
}
;;Replace 10 with your second desired color.;;
alias -l col2 {
  return $+($chr(3),2,$1-,$chr(3)) 
}
alias -l cleanup {
  unset %price*