All pastes #138551 Raw Edit

Unnamed

public text v1 · immutable
#138551 ·published 2006-08-19 08:03 UTC
rendered paste body
on *:sockread:price.socket.*:{
  var %i $right($sockname,-13)
  var %temptext 
  sockread %temptext
  if ($SockErr) { /notice %price.nick. [ $+ [ %i ] ] Sorry but an error occured while searching for %price.item. [ $+ [ %i ] ] | /sockclose $sockname | /unset %price.*. [ $+ [ %i ] ] }
  else { 
    :next
    var %temptext
    sockread %temptext
    /set %price.displayed. [ $+ [ %i ] ] 0
    ;Once bot gets the Item + Price which is represented my %readnextline == 2, it runs this to display the results for the user then restarts the whole proccess.
    if (%price.readnextline. [ $+ [ %i ] ] == 2) { 
      /inc %price.displayed. [ $+ [ %i ] ]
      /var %message 12 %price.displayitem. [ $+ [ %i ] ] - 7 $htmlfree(%temptext)
      /unset %price.readnextline. [ $+ [ %i ] ] 

      ; Limits how many items are displayed before it stops reading. Prevents the bot from flooding.
      if ( %price.displayed. [ $+ [ %i ] ] < 6 ) {
        if ( %price.displaystyle. [ $+ [ %i ] ] == private ) { /notice %price.nick. [ $+ [ %i ] ] %message | goto next }
        else { /msg %price.chan. [ $+ [ %i ] ] %message | goto next }
      } ; Closes if statement - if ( %price.displayed. [ $+ [ %i ] ] < 6 )

      else { /notice %price.nick. [ $+ [ %i ] ] 4 Sorry but your search for " $+ %price.item. [ $+ [ %i ] ] $+ " was not specific enough. Please narrow your searh down, ie: Runes --> Fire Rune | $closesocket($sockname,price) }  
    } ; Closes if statement - if (%readnextline == 2)

    if (%price.readnextline. [ $+ [ %i ] ] == 1) { /set %price.displayitem. [ $+ [ %i ] ] $htmlfree(%temptext) | /set %price.readnextline. [ $+ [ %i ] ] 2 }
    if (*<img src="/img/member.gif"* iswm %temptext || <td class="tablebottom"><!-- Blank --></td> iswm %temptext) { /set %price.readnextline. [ $+ [ %i ] ] 1 }
    if (*Your search did not * iswm %temptext) { /notice %price.nick. [ $+ [ %i ] ] 4 Sorry I did not find " $+ %price.item. [ $+ [ %i ] ] $+ " in the Zybez database. | $closesocket($sockname,price) }
    if (<p style="text-align: center;">Zybez.net is momentarily offline * iswm %temptext) { /notice %price.nick. [ $+ [ %i ] ] 5,15 Sorry but zybez is currently offline. | $closesocket($sockname,price) }  
    if (<!-- Search Results: End --> isin %temptext) { $closesocket($sockname,price) }
    else goto next
  } ; Closes else 
} ;Ends the sockread section


alias -l closesocket {
  /sockclose $1
  /unset $+(%,$2,.,*,.,$right($1,-13))
}