All pastes #745826 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-10-22 18:35 UTC
rendered paste body
on $*:TEXT:/^[!@.]alch/Si:#:{ 
  if (!$2) { notice $nick You must supply an item to lookup } 
  else { 
    inc %id 
    set $+(%,a.style.,%id) $iif($left($1,1) == @,msg $chan,notice $nick) 1[4ALCH1]14: 
    set $+(%,a.word.,%id) $replace($2-,$chr(32),+) 
    sockopen $+(up.,%id) tip.it 80 
  } 
} 
on *:SOCKOPEN:up.*:{ 
  var %id = $gettok($sockname,2,46) 
  sockwrite -n $sockname GET /runescape/index.php?rs2item=&orderby=0&keywords= $+ $($+(%,a.word.,%id),2) $+ &Players=all&category=0&subcategory=0&cmd=8&action=Manage_Items&search=1 
  sockwrite -n $sockname Host: tip.it 
  sockwrite -n $sockname $+($crlf,$crlf) 
} 
on *:SOCKREAD:up.*:{ 
  var %id = $gettok($sockname,2,46) 
  var %style = $($+(%,a.style.,%id),2) 
  var %item = $($+(%,a.word.,%id),2) 
  if ($sockerr) { 
    %style 14An error occured while connecting, please try again.
    unset $+(%,a.*) 
    sockclose $+(up.,%id) 
  } 
  else { 
    var %read 
    sockread %read 
    if (*No items matched your search* iswm %read) { 
      %style No results were found for " $+ %item $+ " 
      unset $+(%,a.*) 
      sockclose $+(up.,%id) 
    } 
    if ($regex(%read,/<td><a href="(.*)">(.*)</a></td>/Si)) { 
      set $+(%,a.name.,%id) $regml(2) 
      set $+(%,a.link.,%id) $regml(1) 
      sockopen $+(alch.,%id) tip.it 80 
      sockclose $+(up.,%id) 
    } 
  } 
} 
on *:SOCKOPEN:alch.*:{ 
  var %id = $gettok($sockname,2,46) 
  sockwrite -n $sockname GET /runescape/ $+ $($+(%,a.link.,%id),2) HTTP/1.1 
  sockwrite -n $sockname Host: tip.it 
  sockwrite -n $sockname $+($crlf,$crlf) 
} 
on *:SOCKREAD:alch.*:{ 
  var %id = $gettok($sockname,2,46) 
  var %style = $($+(%,a.style.,%id),2) 
  var %item = $($+(%,a.item.,%id),2) 
  if ($sockerr) { 
    %style 14An error occured while connecting, try again soon.
    unset $+(%,a.*) 
    sockclose $+(alch.,%id) 
  } 
  else { 
    var %read 
    sockread %read 
    if ($($+(%,a.found.lalch.,%id),2)) { 
      inc $+(%,a.time4.,%id) 
      if ($($+(%,a.time4.,%id),2) == 2) { 
        tokenize 32 $nohtml(%read) 
        set $+(%,a.lalch.,%id) $remove($1-,$chr(09)) 
        unset $+(%,a.found.lalch.,%id) 
      } 
    } 
    if ($($+(%,a.found.halch.,%id),2)) { 
      inc $+(%,a.time1.,%id) 
      if ($($+(%,a.time1.,%id),2) == 2) { 
        tokenize 32 $nohtml(%read) 
        set $+(%,a.halch.,%id) $remove($1-,$chr(09)) 
        unset $+(%,a.found.halch.,%id) 
      } 
    } 
    if (*<td class="header" width="25%">High Alchemy</td>* iswm %read) { 
      set $+(%,a.found.halch.,%id) true 
    } 
    if (*<td class="header" width="25%"> Gen. store buys/low alch</td>* iswm %read) { 
      set $+(%,a.found.lalch.,%id) true 
    } 
    if (*<td colspan="3"> <B>Examine:* iswm %read) { sockread %read | $+(%,a.style.,%id) %read }
    if (*<!-- Page Content End -->* iswm %read) { 
      %style 1"4 $+ $($+(%,a.name.,%id),2) $+ 1"14. High Alch:4 $bytes($($+(%,a.halch.,%id),2),db) $+ gp14. Low Alch:4 $bytes($($+(%,a.lalch.,%id),2),db) $+ gp14.
      unset $+(%,a.*) 
      sockclose $+(alch.,%id) 
    } 
  } 
}


how would i use "    if (*<td colspan="3"> <B>Examine:* iswm %read) { sockread %read | echo -a %read }"
in the style of rest? such as:-
   set $+(%,a.found.lalch.,%id) true 
or isn't it needed?
but yes it did echo the correct thing