mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#4025 30/12/02 03:25 AM
Joined: Dec 2002
Posts: 111
F
Frog Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: Dec 2002
Posts: 111
Below is a script someone from the old boards made for me. And, as he said, if the site ever changed its layout, the script would most likely fail. So, I was wondering if anyone would help me fix it. Here's the code:

Code:
alias high.score {
  sockclose rune
  sockopen rune www.runescape.com 80
  if ($1) {
    .sockmark rune /hiscoreuser.cgi?username= $+ $replace($1-,$chr(32),_)
  }
  else {
    .sockmark rune /hiscore.html
  }
}
on *:sockopen:rune:{
  if ($sockerr) {
    echo $color(info) -s *** Socket Error (on open) \ $sockname - $sock($sockname).ip
    return
  }
  sockwrite -n $sockname GET $sock($sockname).mark HTTP/1.1
  sockwrite -n $sockname Accept: */*
  sockwrite -n $sockname Host: www.runescape.com
  sockwrite -n $sockname $crlf
}
on *:sockread:rune:{
  if ($sockerr) {
    echo $color(info) -s *** Socket Error (on read) \ $sockname - $sock($sockname).ip
    return
  }
  var %tmp,%ex = ^(<table>|</td>),%un = $gettok($sock($sockname).mark,-1,61)
  sockread %tmp
  if (<font size=3> isin %tmp) { 
    tokenize 62 %tmp   
    echo -s $remove($3,</b)   
    echo -s Rank Name Level XP 
  }  
  if (<b>Name</b> isin %tmp) { 
    set %rank 0
  } 
  if (<b>Level</b> isin %tmp) {
    set %rank 0
  }  
  if (<b>XP</b> isin %tmp) {
    set %rank 0
  } 
  if (<b>Rank</b> isin %tmp) { 
    set %rank 0 
  }  
  if (You do not appear in the top isin %tmp) {
    echo -s $remove(%tmp,<br>)   
    echo -s -   
  } 
  if (This user does not appear isin %tmp) {
    echo -s %tmp
  } 
  if ((%rank isnum 0-11) && ($regex(%tmp,<br>$)) && (!$regex(%tmp,%ex))) { 
    inc %rank 
    set $+(%,rune.,%rank) $($+(%,rune.,%rank),2) $remove(%tmp,<br>) 
  }  
  if (</td></tr></table> isin %tmp) {     
    if ($var(%rune.*,0)) {   
      var %n = 1     
      while (%n <= 11) {    
        if ($($+(%,rune.,%n),2)) { 
          echo -s $iif(%un == $gettok($($+(%,rune.,%n),2),2,32),) $+ $($+(%,rune.,%n),2)  
        }     
        inc %n   
      }   
      echo -s -  
    } 
    unset %rune.* 
  } 
  if (</html> isin %tmp) { 
    unset %rune.* %rank 
  }
}


Usage: /high.score [username]

It connects to www.runescape.com and looks up the player's highscores if they exist. You dont have to specifiy a username. If not, it just displays the top 10. Anyway, I dont really know much abour $regex, $regusb, or sockets (used this way) to fix it by myself, so, could someone help me here? Thanks.


Experience The Void.. Are You Ready?
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Change hiscore.html to hiscores.html

Joined: Dec 2002
Posts: 111
F
Frog Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: Dec 2002
Posts: 111
Ok, even with that done, it still doesnt work right. It only returns..

78 polgara 1317 32788750
79 topper314 1317 30940250
80 wapiti 1315 39925250
81 melbelle 1315 27803250
82 punxstar 1315 27589000
83 ladykilljoy 1313 77351000
84 august41 1313 34884000
85 blueonix 1312 38976250
86 money_chan 1311 30690000
87 monofoto 1311 29917000
88 bluez2885 1311 28339750

And it's supposed to go through all the skills and such.


Experience The Void.. Are You Ready?
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
It shows only 15 surrounding players, take a look: http://www.runescape.com/hiscores.html. I don't think we can make it to send the whole list.

If it's not what you meant to, please rephrase.

Joined: Dec 2002
Posts: 111
F
Frog Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: Dec 2002
Posts: 111
yes, yes, I know that. but, did you see the "fishing" and stuff beside that? last time, it went through all those stats and got those as well. it was kinda like this:

overall
sdjksa
asda
asdas
PLAYER
asfdsd
dfsf
sdfsf

Fishing
a
dsasd
as
dsad
PLAYER
dfsdf
sgf

And so on. but.. from how they have it set up now, it looks like iti'd take quite some time to get the stats for everything on the person.


Experience The Void.. Are You Ready?
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
I made a script that can look up a certain person and then puts all the results for that person in a dialog, so I'll have a look at trying to make it get the top 10 for each stat...

Joined: Dec 2002
Posts: 111
F
Frog Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: Dec 2002
Posts: 111
Well, here's why.

The old way they had the users' hiscores is changed..

It used to just be: /hiscoreuser.cgi?username=

Now it's: hiscoreuser.cgi?username=PLAYER&category=0 And the 0 changes for what stat you want to see.

So..yeah, I dunno.


Experience The Void.. Are You Ready?
Joined: Dec 2002
Posts: 111
F
Frog Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: Dec 2002
Posts: 111
Well.. you'd have to have it use a :loop, and go back through it once it was done checking to see whether you were in that list or not.. here's a start, although horridly sloppy.

Code:
alias high.score {
  sockclose rune
  sockopen rune www.runescape.com 80
  if ($1) {
    var %c 0
    .sockmark rune /hiscoreuser.cgi?username= $+ $replace($1-,$chr(32),_) $+ &category= $+ %c
  }
  else {
    .sockmark rune /hiscores.html
  }
}
on *:sockopen:rune:{
  if ($sockerr) {
    echo $color(info) -s *** Socket Error (on open) \ $sockname - $sock($sockname).ip
    return
  }
  sockwrite -n $sockname GET $sock($sockname).mark HTTP/1.1
  sockwrite -n $sockname Accept: */*
  sockwrite -n $sockname Host: www.runescape.com
  sockwrite -n $sockname $crlf
}
on *:sockread:rune:{
  sockread -nt %tmp
  echo -a %tmp
}


You'd have to have it go back and inc %c, then read off the stats for that section.I dont care if I cant get it to get the top 10 for each stat, I'm just looking for it to get that person's stats.


Experience The Void.. Are You Ready?
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Here is the one I made to do that. With a bit of tweaking you can get it to stop using the dialog.

Joined: Dec 2002
Posts: 111
F
Frog Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: Dec 2002
Posts: 111
Alrighty, thanks.


Experience The Void.. Are You Ready?
Joined: Dec 2002
Posts: 111
F
Frog Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: Dec 2002
Posts: 111
Ok.. that didnt really help.

Anyway.. I have this. Now, it's echoing 4 things..
<font color=yellow>

well, it echoes that 4 times. and I cant seem to get this to work right...if possible, could someone help me with this so it'd echo things like this:

PLAYER's stats:
Overall: blah
Fishing: blah
Mining: blah

and so fourth. I'm just not good enough to figure this out.


Experience The Void.. Are You Ready?
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
...alright, I've done it..type:
/high.score Name

I tried it on a fresh install so there is no reason it wouldnt work.

on *:SOCKOPEN:rs*:{
if ( $sock($sockname).wserr ) {
echo -a Error: # $+ $sock($sockname).wsmsg
return
}
.remove $sockname $+ .html
sockwrite -n $sockname GET http://www.runescape.com/hiscoreuser.cgi?category= $+ $remove($sockname,rs) $+ &username= $+ %rsn HTTP/1.1
sockwrite -n $sockname Host: www.runescape.com
sockwrite $sockname $crlf
}
on *:SOCKREAD:rs*:{
:nextread
sockread %temp
if ($sockbr == 0) return
if ( $len(%temp) < 500 ) {
write $sockname $+ .html %temp
}
goto nextread
}
on *:SOCKCLOSE:rs*:{
if ( $read($sockname $+ .html, w, <font color=yellow>, 1) == $null ) {
echo -a $replace($remove($sockname,rs),15,Thieving,14,Agility,13,Herblaw,12,Mining,11,Smithing,10,Crafting,9,Firemaking,8,Fishing,7,Fletching,6,Woodcutting,5,Cooking,4,Magic,3,Prayer,2,Ranged,1,Hits,0,Overall) $+ : n/a
goto clearvars
}
else {
var %filler = $read($sockname $+ .html, w, <font color=yellow>, 1)
set %rsr $+ $sockname $remove($read($sockname $+ .html,$calc($readn + 1)),<br>)
var %filler = $read($sockname $+ .html, w, <font color=yellow>, $readn)
set %rsnf $+ $sockname $remove($read($sockname $+ .html,$calc($readn + 1)),<br>)
var %filler = $read($sockname $+ .html, w, <font color=yellow>, $readn)
set %rsl $+ $sockname $remove($read($sockname $+ .html,$calc($readn + 1)),<br>)
var %filler = $read($sockname $+ .html, w, <font color=yellow>, $readn)
set %rse $+ $sockname $remove($read($sockname $+ .html,$calc($readn + 1)),<br>)
}
echo -a Skill: $replace($remove($sockname,rs),15,Thieving,14,Agility,13,Herblaw,12,Mining,11,Smithing,10,Crafting,9,Firemaking,8,Fishing,7,Fletching,6,Woodcutting,5,Cooking,4,Magic,3,Prayer,2,Ranged,1,Hits,0,Overall) Rank: $eval(% $+ rsr $+ $sockname,2) Level: $eval(% $+ rsl $+ $sockname,2) Exp: $eval(% $+ rse $+ $sockname,2)
:clearvars
unset %rsr $+ $sockname
unset %rsl $+ $sockname
unset %rse $+ $sockname
.remove $sockname $+ .html
}
alias high.score {
if ( $sock(rs?) ) {
echo -a Unable, sockname in use
halt
}
set %rsn $1
sockopen rs0 www.runescape.com 80
sockopen rs1 www.runescape.com 80
sockopen rs2 www.runescape.com 80
sockopen rs3 www.runescape.com 80
sockopen rs4 www.runescape.com 80
sockopen rs5 www.runescape.com 80
sockopen rs6 www.runescape.com 80
sockopen rs7 www.runescape.com 80
sockopen rs8 www.runescape.com 80
sockopen rs9 www.runescape.com 80
sockopen rs10 www.runescape.com 80
sockopen rs11 www.runescape.com 80
sockopen rs12 www.runescape.com 80
sockopen rs13 www.runescape.com 80
sockopen rs14 www.runescape.com 80
sockopen rs15 www.runescape.com 80
}

Joined: Dec 2002
Posts: 111
F
Frog Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: Dec 2002
Posts: 111
Er.. it echoes the skills.. but everything is appearing as n/a


Experience The Void.. Are You Ready?
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
If you are entering the a valid name the only reason it wouldn't work is another scipt or your settings interfering are with it, as it works in a fresh installation for me...

Joined: Dec 2002
Posts: 111
F
Frog Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: Dec 2002
Posts: 111
/high.score ScripterX <------


Experience The Void.. Are You Ready?
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Smithing: n/a
Skill: Cooking Rank: 40862 Level: 50 Exp: 111190
Magic: n/a
Firemaking: n/a
Crafting: n/a
Prayer: n/a
Woodcutting: n/a
Ranged: n/a
Skill: Fishing Rank: 42312 Level: 50 Exp: 102180
Agility: n/a
Thieving: n/a
Fletching: n/a
Herblaw: n/a
Mining: n/a
Skill: Hits Rank: 84380 Level: 43 Exp: 52812
Overall: n/a

Joined: Dec 2002
Posts: 111
F
Frog Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: Dec 2002
Posts: 111
I have nfc then.


Experience The Void.. Are You Ready?
Joined: Dec 2002
Posts: 111
F
Frog Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: Dec 2002
Posts: 111
It's not even returning anything for someone who I know is in the highscores. Bah, oh well.


Experience The Void.. Are You Ready?
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Mm bah have you tried it in a clean install? This would check if it is a problem with the script or with something in your scripts..

Joined: Dec 2002
Posts: 111
F
Frog Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: Dec 2002
Posts: 111
It worked before with all the scripts I have now, so I dont think that's the problem.


Experience The Void.. Are You Ready?
Page 1 of 2 1 2

Link Copied to Clipboard