PDA

View Full Version : Minimap orbs



Flight
01-16-2014, 12:47 PM
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.


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.


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.


(*
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.

Solar
01-16-2014, 12:56 PM
Great work, and fast too.

Turpinator
01-16-2014, 02:19 PM
at first i wasnt sure what you were talking about but then...
http://i.imgur.com/DO6xBAv.png

well, no more need for orion.

Nice job. :)

Solar
01-16-2014, 05:09 PM
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.

Turpinator
01-16-2014, 05:11 PM
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!

Sk1nyNerd
01-16-2014, 08:23 PM
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!

Flight
01-17-2014, 12:46 AM
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.

Hoodz
01-17-2014, 04:24 PM
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

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:

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;

Ashaman88
02-05-2014, 06:02 AM
Put these in the OSR include - great job guys

https://github.com/SRL/SRL-OSR/commit/148007bac4ad63ae7527c7a91b7d2b27ded3a007

Hoodz
02-05-2014, 07:13 AM
Put these in the OSR include - great job guys

https://github.com/SRL/SRL-OSR/commit/148007bac4ad63ae7527c7a91b7d2b27ded3a007

Thanks ashaman!

Hoodz
02-06-2014, 03:39 PM
Ashaman88; is this alright? (http://services.runescape.com/m=news/quick-prayers--loot-broadcast?oldschool=1)


{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;

Flight
02-06-2014, 03:53 PM
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.

Hoodz
02-06-2014, 03:57 PM
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?

Ashaman88
02-06-2014, 04:19 PM
I'll check out those three tonight, good job guys - keep it up

Flight
02-07-2014, 01:20 AM
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?

Hoodz
02-07-2014, 11:55 AM
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

Flight
02-08-2014, 02:08 AM
yes look at your first post, its already in the srl-osr include on github

Ah very good then, my mistake. :tongue:

Solar
03-07-2014, 09:53 PM
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.

Flight
03-08-2014, 01:20 AM
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. :thumbsdown:

Solar
03-08-2014, 01:11 PM
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.

Flight
03-08-2014, 02:20 PM
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.