Does any one know how to grab them? because I wanna make a in scar highscore checker.
Printable View
Does any one know how to grab them? because I wanna make a in scar highscore checker.
Make it fetch the data from the site and then just parse it from it.
Use CURL and parse the web page.
"Make it fetch the data" isn't really a great explanation either lol
Depends on what he's using.
I wanna find it from scar. I can get the username as a string.
I was wondering if there is a url that I can insert the string or a php code.
I know SCAR has HTTP functions, but I don't know what they are or how to use them. Sorry lol
does any of you guys know rs's url for getting stats? (html/php)
Post this: http://services.runescape.com/m=hisc...orepersonal.ws
with: user1 and it will output the highscore page with that users stats.
I can make you an example later today if you want?
Sure, but I was wondering if I could just get the individual stats as a results so I could use get page or one of the internet functions.
You can get a lite version of the high scores by parsing the following page:
http://hiscore.runescape.com/index_l...layer=username
where username is the name of the player you want information for.
nice link Method, and that's now simple to parse (split by comma, and then every 2n+2 is the level)
sigh and I made myself a program to compose a page that produces output like that link, for you to parse, oh well was good fun :/
~ Craig` :)
well yeah the space acts as the individual skill delimiter, but you could always scan for /,(-?\d+),/
thanks for the correction though
~ Craig` :)
bleh don't go against everything I say, and if you notice, you'll find that I then suggested using the regular expression, /,(-?\d+),/
demonstrated:
EDIT nicer version imo:Code:require "open-uri"
require "nokogiri"
stats = %w{Overall Attack Defence Strength Constitution Ranged Prayer Magic Cooking Woodcutting Fletching Fishing Firemaking Crafting Smithing Mining Herblore Agility Theiving Slayer Farming Runecrafting Hunter Construction Summoning}
levels = Nokogiri::HTML(open("http://hiscore.runescape.com/index_lite.ws?player=Tiny%20Craig")).to_s.scan(/,(-?\d+),/)
stats.each_with_index do |stat, i|
stats[i] = [stat, levels[i][0]]
end
stats.each do |stat|
puts "#{stat[0]}> #{stat[1]}"
end
outputting:Code:require "open-uri"
require "nokogiri"
stats = {}
levels = Nokogiri::HTML(open("http://hiscore.runescape.com/index_lite.ws?player=Tiny%20Craig")).to_s.scan(/,(-?\d+),/)
%w{Overall Attack Defence Strength Constitution Ranged Prayer Magic Cooking Woodcutting Fletching Fishing Firemaking Crafting Smithing Mining Herblore Agility Theiving Slayer Farming Runecrafting Hunter Construction Summoning}.each_with_index do |key, i|
stats[key] = levels[i][0]
end
stats.each do |skill, level|
puts "#{skill}> #{level}"
end
no hate for Ruby pls.Code:Overall> 903
Attack> -1
Defence> -1
Strength> -1
Constitution> -1
Ranged> -1
Prayer> -1
Magic> -1
Cooking> -1
Woodcutting> -1
Fletching> 66
Fishing> -1
Firemaking> -1
Crafting> 56
Smithing> 47
Mining> 60
Herblore> -1
Agility> -1
Theiving> 31
Slayer> -1
Farming> -1
Runecrafting> 40
Hunter> -1
Construction> 35
Summoning> -1
~ Craig` :)
I was not trying to offend :)
Sweet, thanks.
But do you have a way to get it in scar :(?
love me:
SCAR Code:program new;
var
skillArr: tStringArray;
const
username = 'Zezima';
function Parse(): tStringArray;
var
page: string;
begin
page := GetPage('http://hiscore.runescape.com/index_lite.ws?player='+username);
result := explode(',', page);
end;
var
stats, actualStats: tStringArray;
i: Integer;
begin
skillArr := ['Overall', 'Attack', 'Defence', 'Strength', 'Constitution', 'Ranged', 'Prayer', 'Magic', 'Cooking', 'Woodcutting', 'Fletching', 'Fishing', 'Firemaking', 'Crafting', 'Smithing', 'Mining', 'Herblore', 'Agility', 'Theiving', 'Slayer', 'Farming', 'Runecrafting', 'Hunter', 'Construction', 'Summoning'];
stats := parse();
for i := 0 to high(stats) do
begin
if i mod 2 <> 0 then
begin
setArrayLength(actualStats, length(actualStats)+1);
actualStats[length(actualStats)-1] := stats[i];
end;
end;
for i := 0 to high(skillArr) do
writeLn(skillArr[i]+': '+actualStats[i]);
end.
I'll make a form for you if you say please :>
please :)
I made this not too long ago.
It gathers the data from the 'Adventures Log', so it only works for member accounts, but it gets every skill even it is a low level.
Also I've created a function which calculates a players combat level and 'player type'. :D
Hope you like it.
SCAR Code:program Get_Levels; // By TurboBk
Const
PlayersName = ''; // User to lookup?
PvPOnly = False; // PvP info only?
SaveTxt = False; // Save info to a .txt file?
TxtName = ''; // Only filename, DO NOT add .txt
Function Odd(i: Extended): Boolean;
Begin
Result := (GetOthers(FloatToStr(i / 2)) = '.');
End;
Function HighestValue(Var Which: Integer; N1, N2, N3: Extended): Extended;
Begin
If (N1 >= N2) And (N1 >= N3) Then
Begin Result := N1; Which := 1; End;
If (N2 >= N3) And (N2 >= N1) Then
Begin Result := N2; Which := 2; End;
If (N3 >= N1) And (N3 >= N2) Then
Begin Result := N3; Which := 3; End;
End;
Function SaveInfo(FName: String): Boolean;
Var
F: Integer;
SV: String;
Begin
SV := IntToStr(GetSCARVersion);
Insert('.', SV, 2);
F := RewriteFile('C:\Program Files\SCAR ' + SV + '\Scripts\' + FName + '.txt', False);
If WriteFileString(F, GetDebugText) Then
Begin
WriteLn('Successfully saved to file!');
Result := True;
End Else WriteLn('Failed saving to file!');
CloseFile(F);
End;
Function CalculateCombatLevel(Var PClass: String; Att, Str, Def, Ranged, Pray, Mage, Cons, Summ: Extended): Extended;
Var
BaseCL, ClassCL: Extended;
MeleeC, RangedC, MageC: Extended;
PlayerClass: Integer;
Begin
Def := Def * 100;
Cons := Cons * 100;
If Odd(Pray) Then
Pray := ((Pray - 1) * 50)
Else Pray := Pray * 50;
If Odd(Summ) Then
Summ := ((Summ - 1) * 50)
Else Summ := Summ * 50;
BaseCL := ((Def + Cons + Pray + Summ) / 400);
Att := Att * 130;
Str := Str * 130;
If Odd(Ranged) Then
Ranged := ((Ranged * 195) - 65)
Else Ranged := Ranged * 195;
If Odd(Mage) Then
Mage := ((Mage * 195) - 65)
Else Mage := Mage * 195;
MeleeC := ((Att + Str) / 400);
RangedC := (Ranged / 400);
MageC := (Mage / 400);
ClassCL := HighestValue(PlayerClass, MeleeC, RangedC, MageC);
Case PlayerClass Of
1: PClass := 'Melee (' + FloatToStr(MeleeC) + ')';
2: PClass := 'Ranged (' + FloatToStr(RangedC) + ')';
3: PClass := 'Mage (' + FloatToStr(MageC) + ')';
End;
Result := (ClassCL + BaseCL);
End;
Procedure GetPlayerLevels(RSUser: String; PvPInfo: Boolean);
Var
Name, Page: String;
TL, Attack, Defence, Strength, Constitution, Ranged, Prayer,
Magic, Cooking, Woodcutting, Fletching, Fishing, Firemaking, Crafting,
Smithing, Mining, Herblore, Agility, Thieving, Slayer, Farming,
Runecrafting, Hunter, Construction, Summoning, Combat, PType: String;
Begin
Name := RSUser;
If (Pos(' ', Name) <> 0) Then
Name := Replace(Name, ' ', '%A0');
If (Pos('_', Name) <> 0) Then
Name := Replace(Name, '_', '%A0');
Page := '';
Page := GetPage('http://services.runescape.com/m=adventurers-log/display_player_profile.ws?searchName=' + Name);
If Not (Page = '') Then
Begin
If Not (Pos('Non-member account', Page) <> 0) Then
Begin
If Not (Pos('Private profile', Page) <> 0) Then
Begin
If Not (Pos('Account not found', Page) <> 0) Then
Begin
Page := Between('var skills=[', '/* Init', Page);
TL := Between('skill(''Total Level'',', ')', Page);
TL := Between(''',', ',''', TL);
Attack := Between('skill(''Attack'',', ')', Page);
Attack := Between(''',', ',''', Attack);
Defence := Between('skill(''Defence'',', ')', Page);
Defence := Between(''',', ',''', Defence);
Strength := Between('skill(''Strength'',', ')', Page);
Strength := Between(''',', ',''', Strength);
Constitution := Between('skill(''Constitution'',', ')', Page);
Constitution := Between(''',', ',''', Constitution);
Ranged := Between('skill(''Ranged'',', ')', Page);
Ranged := Between(''',', ',''', Ranged);
Prayer := Between('skill(''Prayer'',', ')', Page);
Prayer := Between(''',', ',''', Prayer);
Magic := Between('skill(''Magic'',', ')', Page);
Magic := Between(''',', ',''', Magic);
Cooking := Between('skill(''Cooking'',', ')', Page);
Cooking := Between(''',', ',''', Cooking);
Woodcutting := Between('skill(''Woodcutting'',', ')', Page);
Woodcutting := Between(''',', ',''', Woodcutting);
Fletching := Between('skill(''Fletching'',', ')', Page);
Fletching := Between(''',', ',''', Fletching);
Fishing := Between('skill(''Fishing'',', ')', Page);
Fishing := Between(''',', ',''', Fishing);
Firemaking := Between('skill(''Firemaking'',', ')', Page);
Firemaking := Between(''',', ',''', Firemaking);
Crafting := Between('skill(''Crafting'',', ')', Page);
Crafting := Between(''',', ',''', Crafting);
Smithing := Between('skill(''Smithing'',', ')', Page);
Smithing := Between(''',', ',''', Smithing);
Mining := Between('skill(''Mining'',', ')', Page);
Mining := Between(''',', ',''', Mining);
Herblore := Between('skill(''Herblore'',', ')', Page);
Herblore := Between(''',', ',''', Herblore);
Agility := Between('skill(''Agility'',', ')', Page);
Agility := Between(''',', ',''', Agility);
Thieving := Between('skill(''Thieving'',', ')', Page);
Thieving := Between(''',', ',''', Thieving);
Slayer := Between('skill(''Slayer'',', ')', Page);
Slayer := Between(''',', ',''', Slayer);
Farming := Between('skill(''Farming'',', ')', Page);
Farming := Between(''',', ',''', Farming);
Runecrafting := Between('skill(''Runecrafting'',', ')', Page);
Runecrafting := Between(''',', ',''', Runecrafting);
Hunter := Between('skill(''Hunter'',', ')', Page);
Hunter := Between(''',', ',''', Hunter);
Construction := Between('skill(''Construction'',', ')', Page);
Construction := Between(''',', ',''', Construction);
Summoning := Between('skill(''Summoning'',', ')', Page);
Summoning := Between(''',', ',''', Summoning);
Combat := FloatToStr(CalculateCombatLevel(PType, StrToInt(Attack), StrToInt(Strength), StrToInt(Defence), StrToInt(Ranged), StrToInt(Prayer), StrToInt(Magic), StrToInt(Constitution), StrToInt(Summoning)));
End Else
Begin
WriteLn('ERROR: Invalid account name, please check the account name and try again.');
TerminateScript;
End;
End Else
Begin
WriteLn('ERROR: Private Profile, can only retreive Info from Public Profiles.');
TerminateScript;
End;
End Else
Begin
WriteLn('ERROR: Non-Member Account, can only retreive Info from Members Accounts.');
TerminateScript;
End;
End Else
Begin
WriteLn('ERROR: Could not retrieve Info.');
TerminateScript;
End;
If Not PvPInfo Then
Begin
WriteLn('[*] Player Name: ' + RSUser);
WriteLn('[*] Combat Level: ' + Combat);
WriteLn('[*] Total Level: ' + TL);
WriteLn('[*] Player Type: ' + PType);
WriteLn('[*] Attack: ' + Attack);
WriteLn('[*] Strength: ' + Strength);
WriteLn('[*] Defence: ' + Defence);
WriteLn('[*] Ranged: ' + Ranged);
WriteLn('[*] Prayer: ' + Prayer);
WriteLn('[*] Magic: ' + Magic);
WriteLn('[*] Constitution: ' + Constitution);
WriteLn('[*] Cooking: ' + Cooking);
WriteLn('[*] Woodcutting: ' + Woodcutting);
WriteLn('[*] Fletching: ' + Fletching);
WriteLn('[*] Fishing: ' + Fishing);
WriteLn('[*] Firemaking: ' + Firemaking);
WriteLn('[*] Crafting: ' + Crafting);
WriteLn('[*] Smithing: ' + Smithing);
WriteLn('[*] Mining: ' + Mining);
WriteLn('[*] Herblore: ' + Herblore);
WriteLn('[*] Agility: ' + Agility);
WriteLn('[*] Thieving: ' + Thieving);
WriteLn('[*] Slayer: ' + Slayer);
WriteLn('[*] Farming: ' + Farming);
WriteLn('[*] Runecrafting: ' + Runecrafting);
WriteLn('[*] Hunter: ' + Hunter);
WriteLn('[*] Construction: ' + Construction);
WriteLn('[*] Summoning: ' + Summoning);
End Else
Begin
WriteLn('[*] Player Name: ' + RSUser);
WriteLn('[*] Combat Level: ' + Combat);
WriteLn('[*] Player Type: ' + PType);
WriteLn('[*] Attack: ' + Attack);
WriteLn('[*] Strength: ' + Strength);
WriteLn('[*] Defence: ' + Defence);
WriteLn('[*] Ranged: ' + Ranged);
WriteLn('[*] Prayer: ' + Prayer);
WriteLn('[*] Magic: ' + Magic);
WriteLn('[*] Constitution: ' + Constitution);
End;
End;
begin
ClearDebug;
GetPlayerLevels(PlayersName, PvPOnly);
If SaveTxt Then
SaveInfo(TxtName);
end.
love me moar!
SCAR Code:program new;
var
skillArr, actualStats: tStringArray;
SavedText: string;
frmDesign : TForm;
Panel : TPanel;
Label1 : TLabel;
UsernameBox : TEdit;
Title: array of TLabel;
Button: tButton;
procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;
procedure ShowFormModal;
begin
frmDesign.ShowModal;
end;
procedure SafeShowFormModal;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;
function Parse(name: string): tStringArray;
var
page: string;
begin
page := GetPage('http://hiscore.runescape.com/index_lite.ws?player='+name);
result := explode(',', page);
end;
procedure ButtonClick(Sender: TObject);
var
stats: tStringArray;
i: Integer;
begin
setArrayLength(actualStats, 0);
stats := parse(UsernameBox.Text);
for i := 0 to high(stats) do
begin
if i mod 2 <> 0 then
begin
setArrayLength(actualStats, length(actualStats)+1);
actualStats[length(actualStats)-1] := stats[i];
end;
end;
SavedText := UsernameBox.Text;
frmDesign.ModalResult:= mrOk;
SafeInitForm;
SafeShowFormModal;
end;
procedure InitForm();
var
i: Integer;
begin
frmDesign := CreateForm;
with frmDesign do
begin
Left := 457;
Top := 117;
Width := 241;
Height := 600;
Caption := ':: Highscore Stats Generator ::';
Color := clBtnFace;
Font.Color := clWindowText;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
end;
Panel := TPanel.Create(frmDesign);
with Panel do
begin
Parent := frmDesign;
Left := 16;
Top := 15;
Width := 193;
Height := 65;
end;
Button := TButton.Create(frmDesign);
with Button do
begin
Parent := frmDesign;
Left := 65;
Top := 90;
Width := 75;
Height := 25;
Caption := 'Search';
OnClick := @ButtonClick;
end;
Label1 := TLabel.Create(Panel);
with Label1 do
begin
Parent := Panel;
Left := 56;
Top := 8;
Width := 64;
Height := 17;
Caption := 'Username';
Font.Color := clWindowText;
Font.Height := -13;
Font.Name := '@Meiryo UI';
Font.Style := [];
ParentFont := False;
end;
UsernameBox := TEdit.Create(Panel);
with UsernameBox do
begin
Parent := Panel;
Left := 32;
Top := 32;
Width := 121;
Height := 21;
Hint := Savedtext;
end;
setArrayLength(Title, length(SkillArr)+1);
for i := 0 to high(skillArr) do
begin
Title[i] := TLabel.Create(frmDesign);
with Title[i] do
begin
Parent := frmDesign;
Left := 15;
Top := 150+15*i;
Width := 75;
Height := 25;
Font.Color := clWindowText;
Caption := skillArr[i]+': '+actualStats[i];
end;
end;
Title[High(Title)]:= TLabel.Create(frmDesign);
with Title[i] do
begin
Parent := frmDesign;
Left := 15;
Top := 135;
Width := 75;
Height := 25;
Font.Color := clWindowText;
Caption := 'Name: '+SavedText;
end;
end;
begin
setArrayLength(actualStats, 99);
skillArr := ['Overall', 'Attack', 'Defence', 'Strength', 'Constitution', 'Ranged', 'Prayer', 'Magic', 'Cooking', 'Woodcutting', 'Fletching', 'Fishing', 'Firemaking', 'Crafting', 'Smithing', 'Mining',
'Herblore', 'Agility', 'Theiving', 'Slayer', 'Farming', 'Runecrafting', 'Hunter', 'Construction', 'Summoning'];
SafeInitForm;
SafeShowFormModal;
end.