mIRC Home    About    Download    Register    News    Help

Print Thread
#144667 13/03/06 12:44 AM
Joined: Mar 2006
Posts: 6
H
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
H
Joined: Mar 2006
Posts: 6
Hey, I'm trying to script a RuneScape !stats script, and it's only recieving 1/2 of the information from the page, this is what I have at the moment.

Code:
 on *:TEXT:!stats *:#:{
  set %stat.nick $2-
  set %m $nick
  sockopen stats http://vulcan.runeweb.net 80
}
on *:sockopen:stats:{
  sockwrite -n $sockname GET $+(http://vulcan.runeweb.net/v3/genie1.php?rsname= $+ %stat.nick )
  sockwrite -n $sockname Host: vulcan.runeweb.net
  sockwrite -n $sockname Connection: close
  sockwrite -n $sockname $crlf
}
on *:sockread:stats:{
  if ($sockerr) {
    notice %m %stat.nick Socket Error!
    halt
  }
  else {
    sockread %temptext
    if ($sockbr == 0) { return }
    if (%temptext ==  ) { set %stat.begin 5 }
    if (%temptext == $null) { goto nextread }
    elseif (%stat.begin != $null) {
      :nextread
      var %temptext
      sockread %temptext  
      write test.txt %temptext
      if (%stat.begin == 4) { set %stat.level %temptext }
      elseif (%stat.begin == 5) { set %stat.type %temptext }
      elseif (%stat.begin == 2) { set %stat.rank %temptext }
      elseif (%stat.begin == 1) { set %stat.xp %temptext }
      dec %stat.begin 1
      if (%stat.type == Strength) { 
        set %str %stat.level
      } 
      if ( %stat.type == Attack ) { 
        set %atk %stat.level
      }
      if ( %stat.type == Defence ) { 
        set %def %stat.level
      }
      if ( %stat.type == Magic ) { 
        set %magic %stat.level
      }
      if ( %stat.type == Overall ) { 
        set %overall %stat.level
      }
      if ( %stat.type == Hitpoints ) { 
        set %HP %stat.level
      }
      if ( %stat.type == Ranged ) { 
        set %range %stat.level
      }
      if ( %stat.type == Prayer ) { 
        set %pray %stat.level
      }
      if ( %stat.type == Cooking ) { 
        set %cooking %stat.level
      }
      if ( %stat.type == Woodcutting ) { 
        set %woodcutting %stat.level
      }
      if ( %stat.type == Fletching ) { 
        set %fletch %stat.level
      }
      if ( %stat.type == Fishing ) { 
        set %fish %stat.level
      }
      if ( %stat.type == Firemaking ) { 
        set %firemaking %stat.level
      }
      if ( %stat.type == Crafting ) { 
        set %craft %stat.level
      }
      if ( %stat.type == Smithing ) { 
        set %smithing %stat.level
      }
      if ( %stat.type == Mining ) { 
        set %mining %stat.level
      }
      if ( %stat.type == Herblore ) { 
        set %herblore %stat.level
      }
      if ( %stat.type == Agility ) { 
        set %agility %stat.level
      }
      if ( %stat.type == Thieving ) { 
        set %thieving %stat.level
      }
      if ( %stat.type == Slayer ) { 
        set %slayer %stat.level
      }
      if ( %stat.type == Farming ) { 
        set %farming %stat.level
      }
      if ( %stat.type == Runecraft ) { 
        set %runecrafting %stat.level
      }
    }
  }
}
on *:sockclose:stats:{
  notice %m Stats for %stat.nick : Overall: %overall , Strength: %str , Attack: %atk , Defence: %def , Hitpoints: %HP , Magic: %magic , Ranged: %range , Prayer: %pray , Cooking: %cooking , Woodcutting: %woodcutting , Fishing: %fish , Fletching: %fletching , Firemaking: %firemaking , Crafting: %craft , Smithing: %smith , Mining %mining , Herblore: %herblore , Thieving: %thieving , Slayer: %slayer , Farming: %farming , Runecrafting: %runecrafting .  
  {
  set %runecrafting 0 }
  { set %farming 0 }
  { set %firemaking 0 } 
  { set %thieving 0 }
  { set %agility 0 }
  { set %slayer 0 }
  { set %herblore 0 }
  { set %mining 0 }
  { set %smithing 0 }
  { set %craft 0 }
  { set %fish 0 }
  { set %fletch 0 }
  { set %woodcutting 0 }
  { set %pray 0 }
  { set %atk 0 }
  { set %def 0 }
  { set %str 0 }
  { set %overall 0 }
  { set %range 0 }
  { set %magic 0 }
  { set %HP 0 }
  { set %cooking 0
} } 

#144668 13/03/06 06:06 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
You might get better success in help if u handed us a valid %stat.nick value to test the script with, or at least go to the site and see what the page contains, to see where you might have gone wrong.


aka sockwrite -n $sockname GET $+(http://vulcan.runeweb.net/v3/genie1.php?rsname= $+ %stat.nick )

#144669 13/03/06 10:12 AM
Joined: Mar 2006
Posts: 6
H
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
H
Joined: Mar 2006
Posts: 6
zezima, ngor36, hamtarorox, blackskies4, shadowmikey5, take your pick.

#144670 13/03/06 10:37 AM
Joined: Mar 2006
Posts: 6
H
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
H
Joined: Mar 2006
Posts: 6
I seem to have discovered that it skips every second set of information.

If someone could help me it would be GREATLY appreciated.

#144671 14/03/06 05:28 AM
Joined: Mar 2006
Posts: 6
H
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
H
Joined: Mar 2006
Posts: 6
Fixed it. Thanks for your help however.

#144672 14/03/06 08:21 AM
Joined: Aug 2004
Posts: 5
V
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
V
Joined: Aug 2004
Posts: 5
well i thank you for spotting a bug with that script. now here's a more revised way to do that.
Code:
on *:text:*:#:{
 if ($1 == !stats) || ($1 == @stats) {
   set %stats.chan $chan | set %stats.nick $nick | set %stats.msg $iif($left($1,1) == @,msg $chan,notice $nick)
   if ($2 == -s) { writeini namedb.ini RS-Names $address($nick,3) $replace($3-,$chr(32),+) | %stats.msg Name Stored Successfully. | unset %stats.* | halt }
   if ($2- != -s) { set %stats.rsn $replace($2-,$chr(32),+) }
   if ($2- == $null) { set %stats.rsn $readini($scriptdirnamedb.ini,RS-Names,$address($nick,3)) }
   if (%stats.rsn == $null) { notice $nick Please either specify an rs name or store yours via $1 -s rs-name | unset %stats.* | halt }
   if ($sock(stats).status != $null) { notice $nick Stats Script is in use. Try again.... now! | unset %stats.* | halt }
   if ($len(%stats.name) > 12) { notice $nick Error: name too long. | unset %stats.* | halt }
   sockopen stats vulcan.runeweb.net 80
  ;msg color 1;
   set %stats.color1 $+($chr(3),14)
  ;msg color 2;
   set %stats.color2 $+($chr(3),04)
 }
}
on *:sockopen:stats:{
 sockwrite -nt $sockname GET /v3/stats.genie?rsname= $+ %stats.rsn HTTP/1.0
 sockwrite -nt $sockname User-Agent: Armadyl and Genie FTW
 sockwrite -nt $sockname Host: vulcan.runeweb.net $+ $crlf $+ $crlf
}
on *:sockread:stats:{
 if ($sockerr > 0) { .notice %stats.nick Error: Try again later. | unset %stats.* | halt }
 var %stats.read | sockread %stats.read
 if (<b>Personal isin %stats.read) { set %stats.name $remove(%stats.read,Personal $+ $chr(32),Scores $+ $chr(32),For $+ $chr(32),<b>,</b>) | set %stats.text $remove(%stats.read,<b>,</b>) | set %stats.text $left(%stats.text,- $+ $len(%stats.name)) }
 tokenize 124 $remove(%stats.read,Genie:)
 if ($0 == 4) { %stats.printline1 = %stats.printline1 $+(%stats.color1,$1,:,%stats.color2,$chr(32),$3) }
}
on *:sockclose:stats:{
 if (%stats.printline1 != $null) { %stats.msg %stats.color1 $+ %stats.text $+ %stats.color2 %stats.name | %stats.msg %stats.printline1 }
 if (%stats.printline1 == $null) { %stats.msg This Person does not appear on the hiscores. }
 unset %stats.*
}


Link Copied to Clipboard