All pastes #273372 Raw Edit

Unnamed

public text v1 · immutable
·published 2006-12-09 21:16 UTC
rendered paste body
on *:LOAD: {
  echo -a 4RuneScape Price Checker Loaded
  echo -a 4To use the price checker either type /PriceCheck or go to Commands - RuneScape Price Checker
  echo -a 4Credits:
  echo -a 4[M]ike - Main design/coding.
  echo -a 4Slushpuppy - Price Parser
  echo -a 4Annie & AlternativeNick - Bug fixes, etc.
}
alias pricecheck {
  dialog -md price_check price_check
}
alias viewhelp {
  dialog -md checker_help checker_help
}
alias viewabout {
  dialog -md about about
}
menu channel,menubar,status,nicklist {
  RuneScape Price Checker
  .Check Prices: pricecheck
  .Help: viewhelp
  .About: viewabout
}
dialog about {
  title "About"
  size -1 -1 126 49
  option dbu
  text "About", 1, 52 4 15 8, center
  edit "The RuneScape price checker was made and designed by [M]ike, it uses Slushpuppys php price parser, which is linked to Zybez.net's market price guide, later Annie also helped to fix many bugs in the code. I'm always looking for something to code, a challenge etc. so if you wish to request a script email me at confusedconversation@hotmail.com", 2, 2 16 119 29, read multi autovs vsbar
}

dialog checker_help {
  title "Price Checker Help"
  size -1 -1 111 112
  option dbu
  text "Help", 1, 17 4 70 9, center
  edit "Searching for item prices is simple, just enter the name of an item into the box and then click search, searching for prices may take up to one minute. The results will then be returned in the large area below, if you recieve a 'Socket Error' message, simply wait a few minuntes then try again.", 2, 10 17 88 91, read multi autovs vsbarar
  menu "File", 3
  item "About", 4, 3
  item "Exit", 8, 3
  menu "Links", 5
  item "Zybez", 6, 5
  item "SwiftIRC", 7, 5
}
on *:DIALOG:checker_help:menu:6:{
  url -n http://www.zybez.net
}
on *:DIALOG:checker_help:menu:7:{
  url -n http://forum.swiftirc.net
}
on *:DIALOG:checker_help:menu:8:{
  dialog -x checker_help
}
on *:DIALOG:checker_help:menu:4:{
  /viewabout
}
dialog price_check {
  title "RuneScape Price Checker - By [M]ike"
  size -1 -1 198 113
  option dbu
  button "Search", 1, 155 6 37 12
  text "Item Name:", 2, 3 8 42 8
  edit "", 3, 48 7 104 10
  list 4, 3 28 188 67, size extsel hsbar vsbar
  text "Thanks to slushpuppy for the price parser.", 5, 5 99 125 8
  text "", 6, 48 19 103 8
  menu "File", 7
  item "Help", 8, 7
  item "About", 13, 7
  item "Exit", 12, 7
  menu "Links", 9
  item "Zybez", 10, 9
  item "SwiftIRC", 11, 9
}
on *:DIALOG:price_check:menu:10:{
  url -n http://www.zybez.net
}
on *:DIALOG:price_check:menu:11:{
  url -n http://forum.swiftirc.net
}
on *:DIALOG:price_check:menu:8:{
  /viewhelp
}
on *:DIALOG:price_check:menu:13:{
  /viewabout
}
on *:DIALOG:price_check:menu:12:{
  dialog -x price_check
}
on *:DIALOG:price_check:sclick:1:{
  if (!$did(price_check,3).text) { 
    did -a $dname 6 Enter an item to search for...
  }

  else {
    set %search $did(price_check,3)
    set %price.item $replace(%search,$chr(32),+) 
    did -a $dname 6 Searching for " $+ %search $+ " - Please wait...
    var %price.read 
    var %price.readed
    sockopen rsprice slushpuppy.silverinterlocution.org 80
  } 
}
on *:SOCKOPEN:rsprice:{ 
  sockwrite -n $sockname GET $+(/price.php?price=,%price.item) HTTP/1.1 
  sockwrite -n $sockname Host: slushpuppy.silverinterlocution.org
  sockwrite -n $sockname $crlf
  did -r price_check 4
} 

on *:SOCKREAD:rsprice:{ 
  var %i = 0
  if ($sockerr) { did -a price_check 6 Socket Error | halt } 
  sockread -f %price.read
  while ($sockbr) {
    sockread %price.read
    if ($regex(%price.read,/^[0-9]+\./Si)) {
      did -a price_check 4 $htmlfree(%price.read)
    }
  }
  did -a price_check 6 Search complete.
}
on *:SOCKCLOSE:rsprice: unset %price.*
alias -l htmlfree {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x)
  return %x 
}