Any one know how to go about getting another users stats on rs through the highscores?
Any one know how to go about getting another users stats on rs through the highscores?
:S It's pretty simple. Just parse it with a Regex and do some string manipulation using the TStringList.
Simba Code:Function ToSkillArray(Name: String): Array Of Array Of String;
var
Data: String;
Categories: String;
Experience: String;
I, J, K: Integer;
TrimmedCategories: TStringArray;
Pieces: TStringList;
Begin
Data := GetPage('http://services.runescape.com/m=hiscore/compare?user1=' + Replace(Name, ' ', '%A0', [rfReplaceAll]));
Categories := Between('<section class="skillIcons">', '</section>', Data);
Pieces := TStringList.Create;
SplitRegExpr('<div class="hiscoreIcon [A-Za-z]+" title="', Categories, Pieces);
SetLength(TrimmedCategories, Pieces.Count);
For I := 0 To Pieces.Count - 1 Do
Begin
If (Pieces.Strings[I] = #10) Then Pieces.Delete(I);
TrimmedCategories[I] := Replace(Replace(Pieces.Strings[I], '"></div>', '', [rfReplaceAll]), #10, '', [rfReplaceAll]);
End;
Pieces.Free;
Experience := Between('<td class="alignleft"><a href="http://services.runescape.com/m=hiscore/ranking?category_type=0&table=0&page=', '</tbody>', Data);
Pieces := TStringList.Create;
SplitRegExpr('<a href="[^>]+">', Experience, Pieces);
For I := 0 To Pieces.Count - 1 Do
Begin
Pieces.Strings[I] := ReplaceRegExpr('[A-Za-z "</>=]+', ReplaceRegExpr('[0-9]+">', Pieces.Strings[I], '', True), '', True);
Pieces.Strings[I] := Replace(Pieces.Strings[I], #10, '', [rfReplaceAll]);
End;
SetLength(Result, High(TrimmedCategories));
For I := 0 To High(TrimmedCategories) - 1 Do
Begin
SetLength(Result[I], 4);
Result[I][0] := TrimmedCategories[I];
For J := 1 To 3 Do
Begin
Result[I][J] := Pieces.Strings[K];
Inc(K);
End;
End;
Pieces.Free;
End;
begin
writeln(ToSkillArray('Jake'));
end.
Progress Report:Compiled successfully in 16 ms. [['Overall', '2', '4,503,285,269', '2,496'], ['Attack', '12', '200,000,000', '99'], ['Defence', '19', '200,000,000', '99'], ['Strength', '20', '200,000,000', '99'], ['Constitution', '6', '200,000,000', '99'], ['Ranged', '20', '200,000,000', '99'], ['Prayer', '23', '200,000,000', '99'], ['Magic', '10', '200,000,000', '99'], ['Cooking', '119', '200,000,000', '99'], ['Woodcutting', '47', '200,000,000', '99'], ['Fletching', '56', '200,000,000', '99'], ['Fishing', '69', '176,382,959', '99'], ['Firemaking', '53', '200,000,000', '99'], ['Crafting', '23', '200,000,000', '99'], ['Smithing', '47', '138,241,365', '99'], ['Mining', '87', '92,633,702', '99'], ['Herblore', '29', '200,000,000', '99'], ['Agility', '145', '39,307,595', '99'], ['Thieving', '19', '200,000,000', '99'], ['Slayer', '3', '200,000,000', '99'], ['Farming', '43', '200,000,000', '99'], ['Runecrafting', '232', '56,719,648', '99'], ['Hunter', '18', '200,000,000', '99'], ['Construction', '24', '200,000,000', '99'], ['Summoning', '3', '200,000,000', '99'], ['Dungeoneering', '67', '200,000,000', '120']] Successfully executed.
Last edited by Brandon; 08-06-2013 at 03:22 AM.
I am Ggzz..
Hackintosher
An easier way would be to get the data through the lite high-score.
I used the code below to get the total lvl of a player for a friend list manager script:
Simba Code:info:= Between(',', ',', GetPage('hiscore.runescape.com/index_lite.ws?player=' + Replace(name, ' ', '_')));
if info = '' then
begin
writeln('Error retrieving player hiscore!');
writeln('Please allow permission for page access!');
writeln('Terminating...');
TerminateScript;
end;
if info <> ' Verdana' then
level:= StrToInt(info)
else
begin
info:= 'Unknown (Non-member)';
level:= -1;
end;
You can simply manipulate the string retrieved if you want the other data of the player.
Last edited by riwu; 08-06-2013 at 11:18 AM.
wow thank you both i love you
but how would i switch it to old school stats
Last edited by xxpoopyxx2; 08-10-2013 at 02:34 AM.
i am a big neck sorry feel dumb lol
so it would be something like this?
Simba Code:procedure GetStats(name : string);
var
info : string;
level : integer;
begin
info:= Between(',', ',', GetPage('http://services.runescape.com/m=hiscore_oldschool/index_lite.ws?player=' + Replace(name, ' ', '_')));
if info = '' then
begin
writeln('Error retrieving player hiscore!');
writeln('Please allow permission for page access!');
writeln('Terminating...');
TerminateScript;
end;
if info <> ' Verdana' then
level:= StrToInt(info)
else
begin
info:= 'Unknown (Non-member)';
level:= -1;
end;
end;
begin
GetStats('Player');
end.
sorry i should know this :/ just been brain dead lol
alright i have manipulated strings in simba with regex so this is what i got and not exactly working...
Simba Code:Function ToSkillArray(Name: String): Array Of Array Of String;
var
Data: String;
Categories: String;
Experience: String;
I, J, K: Integer;
TrimmedCategories: TStringArray;
Pieces: TStringList;
Begin
Data := GetPage('http://services.runescape.com/m=hiscore_oldschool/hiscorepersonal.ws?user1=' + Replace(Name, ' ', '%A0', [rfReplaceAll]));
Categories := Between('<td align="left"><a href="overall.ws?', '<div id="footerHiscores">', Data);
Pieces := TStringList.Create;
SplitRegExpr('hiscores/skill_icon_', Categories, Pieces);
SetLength(TrimmedCategories, Pieces.Count);
For I := 0 To Pieces.Count - 1 Do
Begin
If (Pieces.Strings[I] = #10) Then Pieces.Delete(I);
TrimmedCategories[I] := Replace(Replace(Pieces.Strings[I], '1.gif"></td>', '', [rfReplaceAll]), #10, '', [rfReplaceAll]);
End;
Pieces.Free;
Experience := Between('<tr><td width="35"></td><td width="100"></td><td width="75"></td><td width="40"></td><td width="75"></td></tr>', '<div id="footerHiscores"></div>', Data);
Pieces := TStringList.Create;
SplitRegExpr('<td align="right">', Experience, Pieces);
For I := 0 To Pieces.Count - 1 Do
Begin
Pieces.Strings[I] := ReplaceRegExpr('[A-Za-z "</>=]+', ReplaceRegExpr('[0-9]+">', Pieces.Strings[I], '', True), '', True);
Pieces.Strings[I] := Replace(Pieces.Strings[I], #10, '', [rfReplaceAll]);
End;
SetLength(Result, High(TrimmedCategories));
For I := 0 To High(TrimmedCategories) - 1 Do
Begin
SetLength(Result[I], 4);
Result[I][0] := TrimmedCategories[I];
For J := 1 To 3 Do
Begin
Result[I][J] := Pieces.Strings[K];
Inc(K);
End;
End;
Pieces.Free;
End;
begin
writeln(ToSkillArray(''));
end.
Last edited by Justin; 08-11-2013 at 02:39 AM. Reason: Merged posts
Incase you're still curious. This works and grabs a player's combat level.
Simba Code:[/procedure GetStats(name : string);
var
total, hsString : string;
cb, RCL, MACL,MCL, level : integer;
totalArray: TStringArray;
begin
//errors
if total = '' then
begin
writeln('Error retrieving player hiscore!');
writeln('Please allow permission for page access!');
writeln('Terminating...');
exit();
end;
if total <> ' Verdana' then
level:= StrToInt(total)
else
begin
total:= 'Unknown (Non-member)';
level:= -1;
exit();
end;
hsString:= GetPage('http://services.runescape.com/m=hiscore_oldschool/index_lite.ws?player=' + Replace(name, ' ', '_', [0,1]));
total:= Between(',', ',', hsString);
totalArray := (MultiBetween(hsString, ',', ','));
//writeln(totalArray[14]);
//Melee combat level def hits pray att str
MCL := floor(0.25*(strtoint(totalArray[4]) + strtoint(totalArray[8]) + floor(strtoint(totalArray[12])/2)) + 0.325*(strtoint(totalArray[2]) + strtoint(totalArray[10])));
RCL := floor(0.25*(strtoint(totalArray[4]) + strtoint(totalArray[8]) + floor(strtoint(totalArray[12])/2)) + 0.325*(floor(strtoint(totalArray[6])/2) + strtoint(totalArray[6])));
MACL := floor(0.25*(strtoint(totalArray[4]) + strtoint(totalArray[8]) + floor(strtoint(totalArray[12])/2)) + 0.325*(floor(strtoint(totalArray[14])/2) + strtoint(totalArray[14])));
if (MCL > RCL and MACL) then
begin
cb := MCL;
end
else if RCL > MACL then
begin
cb := RCL
end
else
cb := MACL;
writeln(cb);
//writeln(level); total
end;
There are currently 1 users browsing this thread. (0 members and 1 guests)