Results 1 to 21 of 21

Thread: Minimap orbs

  1. #1
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default Minimap orbs

    Sorry this took so long. I wrote these within an hour of the game update but for AeroLib so I needed to convert these back to normal SRL-OSR.

    Simba Code:
    function getCurrentHealth(): Integer;
    var
      tpa : TPointArray;
    begin
      tpa    := returnTPAExceptColors([4938344, 0], [20, 0], intToBox(522,56,541,69));
      result := strToIntDef(getTextATPA(clusterTPAEx(tpa,1,10), 5, 'StatChars07'), 0);
    end;

    function getPrayerPoints(): Integer;
    var
      tpa : TPointArray;
    begin
      tpa    := returnTPAExceptColors([4938344, 0], [20, 0], intToBox(522,100,541,112));
      result := strToIntDef(getTextATPA(clusterTPAEx(tpa,1,10), 5, 'StatChars07'), 0);
    end;

    function getRunEnergy(): Integer;
    var
      tpa : TPointArray;
    begin
      tpa    := returnTPAExceptColors([4938344, 0], [20, 0], intToBox(546,136,566,148));
      result := strToIntDef(getTextATPA(clusterTPAEx(tpa,1,10), 5, 'StatChars07'), 0);
    end;

    function isUsingRun(): Boolean;
    var
      tpa : TPointArray;
    begin
      result := findColorsPie(TPA, 6806252, 20, 0, 360, 10, 72, 571, 127, 595, 152, 582, 140);
    end;

    function isPoisoned(): Boolean;
    var
      tpa : TPointArray;
    begin
      result := findColorsPie(TPA, 88587, 30, 0, 360, 10, 72, 544, 46, 567, 69, 582, 140);
    end;

    If you'd like you could merge those first 3 and use a switcher just for the box areas to search for text, similar to the old "MMLevels" functions we had in SRL-5.

    Edit:
    Added 3 more functions: getHealthPercent, getPrayerPercent and toggleDataOrbs. The first two are not 100% accurate because of the shape of the orb. Those of you who know how these two functions work will also know why they cannot be 100% accurate. But they'll be very close indeed. The third function just toggles the "data orbs" on the minimap.

    Simba Code:
    function getHealthPercent(): Integer;
    var
      tpa : TPointArray;
    begin
      Result := 100;
      findColorsPie(tpa, 1184274, 13, 0, 360, 0, 15, 541, 44, 571, 72, 556, 58);
      if length(tpa) < 1 then Exit;
      sortTPAByY(tpa, False);
      result := (((70-tpa[0].y)*4)-2);
      if result < 0 then result := 0;
    end;

    function getPrayerPercent(): Integer;
    var
      l   : Integer;
      tpa : TPointArray;
    begin
      Result := 100;
      findColorsPie(TPA, 1184274, 13, 0, 360, 0, 15, 541, 88, 571, 115, 556, 102);
      l := (length(tpa)-10);
      if l < 0 then l := 0;
      result := round((100-(l/316)*100));
    end;

    function toggleDataOrbs(Enable: Boolean): Boolean;
    begin
      Result := False;
      if not loggedin() then
        Exit;

      if (not gameTab(TAB_OPTIONS)) then
        Exit;

      if Enable then
      begin
        if (countColorTolerance(1777019, 602, 413, 637, 449, 15) > 50) then
        begin
          Result := True;
          Exit;
        end else
        begin
          mouseBox(602, 413, 637, 449, MOUSE_LEFT);
          Result := True;
          Exit;
        end;
      end else if not Enable then
        if (countColorTolerance(1777019, 602, 413, 637, 449, 15) > 50) then
        begin
          mouseBox(602, 413, 637, 449, MOUSE_LEFT);
          Result := True;
        end;
    end;

    Edit 2: I improved the accuracy of getHealthPercent() by using a different method. It should be at least 95% accurate now.

    Simba Code:
    (*
    SetRun
    ~~~~~~

    .. code-block:: pascal

        function setRun(Enable: Boolean): Boolean;

    Sets running on or off.

    .. note::

        by Flight

    Example:

    .. code-block:: pascal

    *)

    function setRun(Enable: Boolean): Boolean;
    var
      x,y : Integer;
    begin
      Result := False;
      if not loggedin() then
        Exit;

      if Enable then
      begin
        if findColorTolerance(x, y, 28552, 571, 127, 595, 152, 20) then
        begin
          result := true;
          exit;
        end else
        begin
          mouseBox(545, 130, 590, 150, MOUSE_LEFT);
          result := true;
          exit;
        end;
      end else if not Enable then
        if findColorTolerance(x, y, 28552, 571, 127, 595, 152, 20) then
        begin
          mouseBox(545, 130, 590, 150, MOUSE_LEFT);
          Result := True;
        end;
    end;

    (*
    isUsingQP
    ~~~~~~

    .. code-block:: pascal

        function isUsingQP(): Boolean;

    Results if we're currently using quick-prayers

    .. note::

        by Flight

    Example:

    .. code-block:: pascal

    *)

    function isUsingQP(): Boolean;
    begin
      result := (countColorTolerance(14610138, 544, 90, 568, 114, 20) < 30);
    end;

    (*
    toggleQP
    ~~~~~~

    .. code-block:: pascal

        function toggleQP(Enable: Boolean): Boolean;

    Toggles quick-prayers on or off.

    .. note::

        by Flight

    Example:

    .. code-block:: pascal

    *)

    function toggleQP(Enable: Boolean): Boolean;
    var
      x,y : Integer;
    begin
      Result := False;
      if not loggedin() then
        Exit;

      if Enable then
      begin
        if isUsingQP() then
        begin
          result := true;
          exit;
        end else
        begin
          mouseBox(522, 96, 565, 113, MOUSE_LEFT);
          result := true;
          exit;
        end;
      end else if not Enable then
        if isUsingQP() then
        begin
          mouseBox(522, 96, 565, 113, MOUSE_LEFT);
          Result := True;
        end;
    end;

    Edit 3: Added run-enabling & quick-prayers enabling.
    Last edited by Flight; 02-06-2014 at 03:51 PM.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  2. #2
    Join Date
    Feb 2012
    Location
    UK
    Posts
    909
    Mentioned
    10 Post(s)
    Quoted
    191 Post(s)

    Default

    Great work, and fast too.
    Solar from RiD.

  3. #3
    Join Date
    Jan 2012
    Posts
    1,596
    Mentioned
    78 Post(s)
    Quoted
    826 Post(s)

    Default

    at first i wasnt sure what you were talking about but then...


    well, no more need for orion.

    Nice job.

  4. #4
    Join Date
    Feb 2012
    Location
    UK
    Posts
    909
    Mentioned
    10 Post(s)
    Quoted
    191 Post(s)

    Default

    I'm sure you already know this Flight, but there is an option to turn the orbs off so it's back to how it looked before the update.
    Solar from RiD.

  5. #5
    Join Date
    Jan 2012
    Posts
    1,596
    Mentioned
    78 Post(s)
    Quoted
    826 Post(s)

    Default

    Quote Originally Posted by Solar View Post
    I'm sure you already know this Flight, but there is an option to turn the orbs off so it's back to how it looked before the update.
    but meow we can easily and quickly get praypoints, hp and run energy without the need of reflection!

  6. #6
    Join Date
    Feb 2013
    Location
    Narnia
    Posts
    615
    Mentioned
    8 Post(s)
    Quoted
    252 Post(s)

    Default

    Quote Originally Posted by Turpinator View Post
    but meow we can easily and quickly get praypoints, hp and run energy without the need of reflection!
    hp wont be such a hassle now!

    View my OSR Script Repository!


    Botted to max
    Guides: How to Report Bugs to the Scripter
    ~~~~ Moved to Java. Currently Lurking ~~~~

  7. #7
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by Solar View Post
    I'm sure you already know this Flight, but there is an option to turn the orbs off so it's back to how it looked before the update.
    Yeah I'll need to go ahead and add that toggle in the settings GameTab. Let me finish my cappuccino first.

    Edit:
    Updated the OP with 3 new functions.
    Last edited by Flight; 01-17-2014 at 04:55 AM.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  8. #8
    Join Date
    Sep 2012
    Location
    Netherlands
    Posts
    2,752
    Mentioned
    193 Post(s)
    Quoted
    1468 Post(s)

    Default

    @Flight if you are going to push this, add a fixed version of SetRun(); too because its broken right now (if you want that ofcourse)

    fixed version: only had to change the box
    Simba Code:
    function SetRun(Run: Boolean): Boolean;
    var
      CCount: Integer;
    begin
      Result := False;
      if (GameTab(tab_Options)) then
      begin
        CCount := CountColorTolerance(2369440, 647, 413, 682, 448, 20);
        if (Run) then
        begin
          if (CCount<1) then
            MouseBox(647, 413, 682, 448, mouse_left);
          Result := True;
        end else
        begin
          if (CCount>1) then
            MouseBox(647, 413, 682, 448, mouse_left);
          Result := True;
        end;
      end;
    end;

    SetOrbs:
    Simba Code:
    function SetOrbs(State: Boolean): Boolean;
    var
      CCount: Integer;
    begin
      Result := False;
      if (GameTab(tab_Options)) then
      begin
        CCount := CountColorTolerance(2369440, 603, 413, 639, 450, 20);
        if (State) then
        begin
          if (CCount<2) then
            MouseBox(603, 413, 639, 450, mouse_left);
          Result := True;
        end else
        begin
          if (CCount>2) then
            MouseBox(603, 413, 639, 450, mouse_left);
          Result := True;
        end;
      end;
    end;

  9. #9
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

  10. #10
    Join Date
    Sep 2012
    Location
    Netherlands
    Posts
    2,752
    Mentioned
    193 Post(s)
    Quoted
    1468 Post(s)

    Default

    Quote Originally Posted by Ashaman88 View Post
    Put these in the OSR include - great job guys

    https://github.com/SRL/SRL-OSR/commi...7d2b27ded3a007
    Thanks ashaman!

  11. #11
    Join Date
    Sep 2012
    Location
    Netherlands
    Posts
    2,752
    Mentioned
    193 Post(s)
    Quoted
    1468 Post(s)

    Default

    @Ashaman88; is this alright? (http://services.runescape.com/m=news...st?oldschool=1)

    Simba Code:
    {returns if you are using quick pray}
    Function isUsingQuickPray(): Boolean;
    begin
      result := CountColorTolerance(10709096, 544, 91, 570, 114, 5) > 1;
    end;

    {toggles the quick pray icon}
    procedure setQuickPray(Pray: Boolean);
    begin
      if (Pray) then
      begin
        if (not isUsingQuickPray) then
          MouseBox(521, 99, 568, 113, Mouse_Left);
      end else
      begin
        if (isUsingQuickPray) then
          MouseBox(521, 99, 568, 113, Mouse_Left);
      end;
    end;


    {toggles the run orb}
    procedure setRunOrb(Run: Boolean);
    begin
      if (Run) then
      begin
        if (not isUsingRun) then
          MouseBox(545, 135, 591, 149, Mouse_Left);
      end else
      begin
        if (isUsingRun) then
          MouseBox(545, 135, 591, 149, Mouse_Left);
      end;
    end;

  12. #12
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    You got me by about 10 minutes. Also, following the normal SRL-OSR format it's better to have these as functions rather than procedures.

    I've updated the OP with 3 new functions.

    Edit:
    Hoodz I suggest you always compile and test your additions before posting them, I see a few mistakes.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  13. #13
    Join Date
    Sep 2012
    Location
    Netherlands
    Posts
    2,752
    Mentioned
    193 Post(s)
    Quoted
    1468 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    You got me by about 10 minutes. Also, following the normal SRL-OSR format it's better to have these as functions rather than procedures.

    I've updated the OP with 3 new functions.

    Edit:
    Hoodz I suggest you always compile and test your additions before posting them, I see a few mistakes.
    yes i edited me post, just noticed it. or is it still wrong?

  14. #14
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

  15. #15
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by hoodz View Post
    yes i edited me post, just noticed it. or is it still wrong?
    Looks good to me. Does SRL-OSR already have a 'isUsingRun' function?

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  16. #16
    Join Date
    Sep 2012
    Location
    Netherlands
    Posts
    2,752
    Mentioned
    193 Post(s)
    Quoted
    1468 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Looks good to me. Does SRL-OSR already have a 'isUsingRun' function?
    yes look at your first post, its already in the srl-osr include on github

  17. #17
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by hoodz View Post
    yes look at your first post, its already in the srl-osr include on github
    Ah very good then, my mistake.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  18. #18
    Join Date
    Feb 2012
    Location
    UK
    Posts
    909
    Mentioned
    10 Post(s)
    Quoted
    191 Post(s)

    Default

    Sorry if this is a bit of a gravedig (not that old), but did these all get replaced in the official OSR include? If they are then I need to update.
    Solar from RiD.

  19. #19
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by Solar View Post
    Sorry if this is a bit of a gravedig (not that old), but did these all get replaced in the official OSR include? If they are then I need to update.
    Yes it is, but for some reason someone put it in "mapwalk.simba"; that's the wrong place... Also whoever committed this didn't document nor give credit.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  20. #20
    Join Date
    Feb 2012
    Location
    UK
    Posts
    909
    Mentioned
    10 Post(s)
    Quoted
    191 Post(s)

    Default

    Right, so went and updated via github and found that at least SetRun wasn't updated, nor was SetRunOrb added.

    Also, what is the purpose of toggleDataOrbs and SetOrbs? The names sound like they might be for the same thing.
    Last edited by Solar; 03-08-2014 at 01:34 PM.
    Solar from RiD.

  21. #21
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by Solar View Post
    Right, so went and updated via github and found that at least SetRun wasn't updated, nor was SetRunOrb added.

    Also, what is the purpose of toggleDataOrbs and SetOrbs? The names sound like they might be for the same thing.
    Beats me. Whoever added them apparently added it twice but as different names.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


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
  •