Results 1 to 6 of 6

Thread: Getting the full hiscores info with Simba[Script]

  1. #1
    Join Date
    May 2012
    Location
    Moscow, Russia
    Posts
    661
    Mentioned
    35 Post(s)
    Quoted
    102 Post(s)

    Default Getting the full hiscores info with Simba[Script]

    Hello. This script gets the full information of account from http://hiscore.runescape.com/. Small and fast script, I wrote that just for fun, maybe for somebody, it would be useful.

    Simba Code:
    program new;

    type
     THiscHeader = record
        Name,Rank,Overall,OverXP: string;
      end;

      TSkill = record
        Name,Rank,Level,XP: string;
      end;

      TSkills = array [0..24] of TSkill;

      TMinigame = record
        Name,Rank,Score: string;
      end;

      TMinigames = array [0..16] of TMinigame;

      TRSPlayer = record
        Header : THiscHeader;
        Skills : TSkills;
        Minigames : TMinigames;
      end;

    const
     JsonAddr = 'http://hiscore.runescape.com/index_lite.ws?player=';
    var
     Skills,Minigames: TStringArray;

    function Occurs(const str, separator: string): integer;
    var
      i, nSep: integer;
    begin
      nSep:= 0;
      for i:= 1 to Length(str) do
        if str[i] = separator then Inc(nSep);
      Result:= nSep;
    end;

    function Explode(const separator: string;const str: string): TStringArray;
    var
      i, n: integer;
      strline, strfield: string;
    begin
      n:= Occurs(str, separator);
      SetLength(Result, n + 1);
      i := 0;
      strline:= str;
      repeat
        if Pos(separator, strline) > 0 then
        begin
          strfield:= Copy(strline, 1, Pos(separator, strline) - 1);
          strline:= Copy(strline, Pos(separator, strline) + 1,
    Length(strline) - pos(separator,strline));
        end
        else
        begin
          strfield:= strline;
          strline:= '';
        end;
        Result[i]:= strfield;
        Inc(i);
      until strline= '';
      if Result[High(Result)] = '' then SetLength(Result, Length(Result) -1);
    end;

    function StrToHeader(name,s: string):THiscHeader;
      var
       TSA: TStringArray;
      begin
        TSA:=Explode(',',s);
        result.Name:=name;
        result.Rank:=TSA[0];
        result.Overall:=TSA[1];
        result.OverXP:=TSA[2];
      end;

     function StrToSkill(name,s: string): TSkill;
      var
       TSA: TStringArray;
      begin
       TSA:=Explode(',',s);
       result.Name:=name;
       result.Rank:=TSA[0];
       result.Level:=TSA[1];
       result.XP:=TSA[2];
      end;

     function StrToMinigames(name,s: string):TMinigame;
     var
       TSA: TStringArray;
     begin
       TSA:=Explode(',',s);
       result.Name:=name;
       result.Rank:=TSA[0];
       result.Score:=TSA[1];
     end;

    function FillHiscores(Nickname: string; var Player: TRSPlayer): integer;
    var
     Info: string;
     i,j,hm: integer;
     TSA: TStringArray;
     Skill: TSkill;
    begin
      Result:=1;
      Info:=GetPage(JsonAddr+nickname);
      if not (Length(info)<>0) then
       begin
        result:=-1;
        exit;
       end;
      TSA:=Explode(#10,Info);
      Player.Header:=StrToHeader(Nickname,TSA[0]);
      j:=0;
      for i:=1 to Length(TSA)-1 do
      begin
        if not (i>25) then
         begin
          Player.Skills[j]:=StrToSkill(Skills[j],TSA[i]);
          Inc(j);
         end else break;
      end;
      j:=0;
      for i:=26 to Length(TSA)-1 do
      begin
          Player.Minigames[j]:=StrToMinigames(Minigames[j],TSA[i]);
          Inc(j);
      end;
    end;

    var
     Player: TRSPlayer;
     i,res: integer;
    begin
     Skills:=['Attack', 'Defence', 'Strength',
      'Hitpoints', 'Ranged', 'Prayer',
      'Magic', 'Cooking', 'Woodcutting',
      'Fletching', 'Fishing', 'Firemaking',
      'Crafting', 'Smithing', 'Mining',
      'Herblore', 'Agility', 'Thieving',
      'Slayer', 'Farming', 'Runecrafting',
      'Hunter', 'Construction', 'Summoning',
      'Dungeoneering'];
     Minigames:=['Bounty Hunters','B.H. Rogues','Dominion Tower',
    'The Crucible','Castle Wars Games','B.A Attackers',
    'B.A Defenders','B.A Collectors','B.A Healers',
    'Duel Tournament','Mobilising Armies','Conquest',
    'Fist of Guthix','GG: Resource Race','GG: Athletics',
    'WE1: Saradomin Team Contribution','WE1: Zamorak Team Contribution'];
      res:=FillHiscores('Jake',Player);
      if (res = -1) then exit;
      ClearDebug;
      WriteLn('Player info from hiscores:');
      WriteLn('Name: '+Player.Header.Name+#32+'Overall:'+Player.Header.Overall+#32+' rank: '+ Player.Header.Rank+#32+'Overall XP: '+Player.Header.OverXP);
      WriteLn('Skills:');
      for i:=0 to 24 do
      begin
        with Player.Skills[i] do
         WriteLn(Name+':'+#32+'Rank: '+Rank+';'+#32+'Level:'+Level+#32+';'+'XP:'+Xp+';');
      end;
      WriteLn('Minigames:');
      for i:=0 to 16 do
      begin
        with Player.Minigames[i] do
         WriteLn(Name+':'+#32+'Rank: '+Rank+';'+#32+'Level:'+Score+#32+';');
      end;


    end.

    OutPut:
    Simba Code:
    Player info from hiscores:
    Name: Jake Overall:2496  rank: 2 Overall XP: 4511239969
    Skills:
    Attack: Rank: 12; Level:99 ;XP:200000000;
    Defence: Rank: 19; Level:99 ;XP:200000000;
    Strength: Rank: 20; Level:99 ;XP:200000000;
    Hitpoints: Rank: 6; Level:99 ;XP:200000000;
    Ranged: Rank: 20; Level:99 ;XP:200000000;
    Prayer: Rank: 23; Level:99 ;XP:200000000;
    Magic: Rank: 10; Level:99 ;XP:200000000;
    Cooking: Rank: 118; Level:99 ;XP:200000000;
    Woodcutting: Rank: 46; Level:99 ;XP:200000000;
    Fletching: Rank: 56; Level:99 ;XP:200000000;
    Fishing: Rank: 67; Level:99 ;XP:181214582;
    Firemaking: Rank: 52; Level:99 ;XP:200000000;
    Crafting: Rank: 23; Level:99 ;XP:200000000;
    Smithing: Rank: 49; Level:99 ;XP:139236665;
    Mining: Rank: 86; Level:99 ;XP:94200736;
    Herblore: Rank: 29; Level:99 ;XP:200000000;
    Agility: Rank: 140; Level:99 ;XP:39841838;
    Thieving: Rank: 19; Level:99 ;XP:200000000;
    Slayer: Rank: 3; Level:99 ;XP:200000000;
    Farming: Rank: 43; Level:99 ;XP:200000000;
    Runecrafting: Rank: 227; Level:99 ;XP:56746148;
    Hunter: Rank: 18; Level:99 ;XP:200000000;
    Construction: Rank: 25; Level:99 ;XP:200000000;
    Summoning: Rank: 3; Level:99 ;XP:200000000;
    Dungeoneering: Rank: 65; Level:120 ;XP:200000000;
    Minigames:
    Bounty Hunters: Rank: -1; Level:-1 ;
    B.H. Rogues: Rank: -1; Level:-1 ;
    Dominion Tower: Rank: 15076; Level:3161189 ;
    The Crucible: Rank: -1; Level:-1 ;
    Castle Wars Games: Rank: 3737; Level:790 ;
    B.A Attackers: Rank: 58965; Level:913 ;
    B.A Defenders: Rank: 64216; Level:639 ;
    B.A Collectors: Rank: 74389; Level:663 ;
    B.A Healers: Rank: 75767; Level:837 ;
    Duel Tournament: Rank: 1567; Level:1917 ;
    Mobilising Armies: Rank: -1; Level:-1 ;
    Conquest: Rank: 1930; Level:1624 ;
    Fist of Guthix: Rank: 22636; Level:2311 ;
    GG: Resource Race: Rank: 983; Level:720 ;
    GG: Athletics: Rank: 24705; Level:605 ;
    WE1: Saradomin Team Contribution: Rank: -1; Level:-1 ;
    WE1: Zamorak Team Contribution: Rank: -1; Level:-1 ;
    Successfully executed.

    PS:The Lazarus source of this see in attachment.

    Cheers,
    Cynic.
    Attached Files Attached Files
    Last edited by CynicRus; 08-14-2013 at 05:58 AM.
    Per aspera ad Astra!
    ----------------------------------------
    Slow and steady wins the race.

  2. #2
    Join Date
    Feb 2012
    Location
    DON'T PM ME ASKING FOR STUFF
    Posts
    2,170
    Mentioned
    38 Post(s)
    Quoted
    423 Post(s)

    Default

    work on that layout ;p

    Player info from hiscores:
    Name: Jake Overall:2496 rank: 2 Overall XP: 4511239969
    Skills:
    Attack:
    Rank: 12; Level:99 ;XP:200000000;
    Defence:
    Rank: 19; Level:99 ;XP:200000000;
    Strength:
    Rank: 20; Level:99 ;XP:200000000;
    Hitpoints:
    Rank: 6; Level:99 ;XP:200000000;
    Ranged:
    Rank: 20; Level:99 ;XP:200000000;

  3. #3
    Join Date
    Jul 2013
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    how would i be able to get osr stats with this?

  4. #4
    Join Date
    May 2012
    Location
    Moscow, Russia
    Posts
    661
    Mentioned
    35 Post(s)
    Quoted
    102 Post(s)

    Default

    Sure. But with few modifications.
    Per aspera ad Astra!
    ----------------------------------------
    Slow and steady wins the race.

  5. #5
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

  6. #6
    Join Date
    May 2012
    Location
    Moscow, Russia
    Posts
    661
    Mentioned
    35 Post(s)
    Quoted
    102 Post(s)

    Default

    Lol=) I don't saw that earlier-)
    Per aspera ad Astra!
    ----------------------------------------
    Slow and steady wins the race.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •