SRL Archive - OSR Help

MiniMap Icon Fonts


Sk1nyNerd

2014-03-01 20:19:01

does anybody know what fonts these are?

[ATTACH=CONFIG]23033[/ATTACH]

i wrote functions for them all but they keep returning wrong numbers for all the fonts ive tried

thanks

Ian

2014-03-01 20:48:57

I don't play OSR, but those look like StatChars

Flight

2014-03-01 21:26:35

That font is 'StatChars07'. AFAIK SRL-OSR already has functions for reading the MM orbs, if not you can add these:
http://villavu.com/forum/showthread.php?t=107639

Sk1nyNerd

2014-03-01 21:50:40

From: Flight
That font is 'StatChars07'. AFAIK SRL-OSR already has functions for reading the MM orbs, if not you can add these:
http://villavu.com/forum/showthread.php?t=107639


oh, i didnt know you added those. i didnt see any in my osr include either so i decided to make them lol. any ways yours looks much cleaner and compressed then mine. i tried the stat chars and for some reason it wont recognize 2, 3, 4, or 9's.

even though u already did them here are mine. all the functions i edited from the from the orginal setrun functions. ideas on why it wont recognize those? is it the font or something to do with the gettext function??

program MiniMapToggles;

{$I SRL-OSR/SRL.Simba}

(*
GetHitPointsMM
~~~~~~~~~~~~

.. code-block:: pascal

function GetHitpointsMM: integer;

Returns the HitPoints on the MM Toggle

.. note::

by Sk1nyNerd

Example:

.. code-block:: pascal

*)
function GetHitPointsMM: integer;
begin
Result := -1;

Result := StrToIntDef(GetNumbers(GetTextAtExWrap(525, 57, 538, 67,
0, 5, 1, 0, 0, 'StatChars07')), - 1);
end;

(*
QuickPray
~~~~~~~~~~~~

.. code-block:: pascal

QuickPray(Pray: Boolean): Boolean;

Turns the Quick Prayers on or off using the Prayer Toggle on the MiniMap

.. note::

by Sk1nyNerd

Example:

.. code-block:: pascal

*)
function QuickPray(Pray: Boolean): Boolean;
var
CCountPurple, CCountWhite: integer;

begin
Result := False;
CCountPurple := CountColorTolerance(5056052, 550, 95, 565, 108, 45);
CCountWhite := CountColorTolerance(9723486, 550, 95, 565, 108, 22);

if ((CCountPurple < 1) and (CCountWhite < 1)) then
begin
Exit;
end;

if (Pray) then
begin
if (CCountWhite < 1) then
MouseBox(550, 95, 565, 108, mouse_left);
Result := True;
end else
begin
if (CCountWhite > 1) then
MouseBox(550, 95, 565, 108, mouse_left);
Result := True;
end;

end;

(*
GetPrayerPointsMM
~~~~~~~~~~~~

.. code-block:: pascal

function GetPrayerPointsMM: integer;

Returns the Prayer Points on the MM Toggle

.. note::

by Sk1nyNerd

Example:

.. code-block:: pascal

*)
function GetPrayerPointsMM: integer;
begin
Result := -1;

Result := StrToIntDef(GetNumbers(GetTextAtExWrap(524, 100, 540, 112,
0, 5, 1, 0, 0, 'StatChars07')), - 1);
end;

(*
QuickPrayAt
~~~~~~~~~

.. code-block:: pascal

function QuickPrayAt(PrayerPoints: integer): Boolean;

Toggles the Prayer icon on the MiniMap if the Prayer Points are greater than
or equal to the PrayerPoints

.. note::

by Sk1nyNerd

Example:

.. code-block:: pascal

*)
function QuickPrayAt(PrayerPoints: integer): Boolean;
var
CP: integer;

begin
Result := False;
CP := GetPrayerPointsMM;

if (CP >= PrayerPoints) then
begin
if QuickPray(True) then
Result := True;
end;
end;

(*
QuickRun
~~~~~~~~~~~~

.. code-block:: pascal

QuickRun(Run: Boolean): Boolean;

Sets Run on or off using the Run Toggle on the MiniMap

.. note::

by Sk1nyNerd

Example:

.. code-block:: pascal

*)
function QuickRun(Run: Boolean): Boolean;
var
CCountGold, CCountGrey: integer;

begin
Result := False;
CCountGold := CountColorTolerance(105406, 574, 133, 590, 144, 23);
CCountGrey := CountColorTolerance(9411739, 574, 133, 590, 144, 36);

if ((CCountGold < 1) and (CCountGrey < 1)) then
Exit;

if (Run) then
begin
if (CCountGold < 1) then
begin
MouseBox(574, 133, 590, 144, mouse_left);
Result := True;
end;
end else
begin
if (CCountGold > 1) then
begin
MouseBox(574, 133, 590, 144, mouse_left);
Result := True;
end;
end;

end;

(*
GetRunEnergyMM
~~~~~~~~~~~~

.. code-block:: pascal

function GetRunEnergyMM: integer;

Returns the Run percentage on the MM Run Toggle

.. note::

by Sk1nyNerd

Example:

.. code-block:: pascal

*)
function GetRunEnergyMM: integer;
begin
Result := -1;

Result := StrToIntDef(GetNumbers(GetTextAtExWrap(547, 136, 566, 149,
0, 5, 1, 0, 0, 'StatChars07')), - 1);
end;

(*
QuickRunAt
~~~~~~~~~

.. code-block:: pascal

function QuickRunAt(EnergyPercent: integer): Boolean;

Toggles the Run icon on the MiniMap if the Energy is greater than or equal
to the EnergyPercent

.. note::

by Sk1nyNerd

Example:

.. code-block:: pascal

*)
function QuickRunAt(EnergyPercent: integer): Boolean;
var
CR: integer;

begin
Result := False;
CR := GetRunEnergyMM;

if (CR >= EnergyPercent) then
begin
if QuickRun(True) then
Result := True;
end;
end;

begin
ClearDebug;
SetupSRL;

QuickPray(false);
QuickRun(true);

writeln(IntToStr(GetHitPointsMM));
writeln(IntToStr(GetPrayerPointsMM));
writeln(IntToStr(GetRunEnergyMM));

end.

Flight

2014-03-01 22:08:46

Yeah, it's because the color of the numbers are dynamic, they change based on the percentage of the remaining count. For example, at full health the text color of your Hitpoints would be green, at critical health it would be red, and the color changes gradually based on the percentage.

What I did was first find all the colors in the box; this would include the static brown background & the dynamic color of the font, then excluded the TPA of the brown background so only the TPA of the font remained (no matter what color it was). Then a simple TPA > ATPA > TextFromATPA to correctly identify the numbers.

Sk1nyNerd

2014-03-01 22:24:20

From: Flight
Yeah, it's because the color of the numbers are dynamic, they change based on the percentage of the remaining count. For example, at full health the text color of your Hitpoints would be green, at critical health it would be red, and the color changes gradually based on the percentage.

What I did was first find all the colors in the box; this would include the static brown background & the dynamic color of the font, then excluded the TPA of the brown background so only the TPA of the font remained (no matter what color it was). Then a simple TPA > ATPA > TextFromATPA to correctly identify the numbers.


oh, i thought color 0 would negate that, no matter the color those would be the numbers that were ignored. the others would still return. i substituted your array for it and they work now :) thanks neat way of doing it

rj

2014-03-01 22:40:07

From: Flight
Yeah, it's because the color of the numbers are dynamic, they change based on the percentage of the remaining count. For example, at full health the text color of your Hitpoints would be green, at critical health it would be red, and the color changes gradually based on the percentage.

What I did was first find all the colors in the box; this would include the static brown background & the dynamic color of the font, then excluded the TPA of the brown background so only the TPA of the font remained (no matter what color it was). Then a simple TPA > ATPA > TextFromATPA to correctly identify the numbers.

You could just search for red, green, and yellow then Combine then merge the TPA :p it's what I did for my RSPS text stuff

function getSimpleText(Colors:TIntegerArray;x1, y1, x2, y2:integer;font:string):String;
var
textTPA:TPointArray;
textATPA, textATPAS:T2DPointArray;
i:integer;
textStr:string;
begin
setLength(textATPAS, length(colors));
for i := 0 to high(colors) do
findColors(textATPAS[i], Colors[i], x1, y1, x2, y2);
textTPA := mergeATPA(textATPAS);
textATPA := SplitTPAEx(textTPA, 1, 10);
filtertpasbetween(textatpa, 0, 1);
SortATPAFromFirstPointX(textATPA, Point(0, 0));
result := getTextATPA(textATPA, 3, font);
end;

What I use for like 80% of my text functions

Flight

2014-03-02 00:47:22

From: Officer Barbrady
You could just search for red, green, and yellow then Combine then merge the TPA :p it's what I did for my RSPS text stuff

What I use for like 80% of my text functions


Yes there's always multiple ways to accomplish something like that. I believe in the beginning of the SRL-OSR that same method was applied for getting UpText, getting multiple TPA's of multiple colors then combining and filtering. It depends mostly on personal preference.

By the way, why are you using SplitTPA? :huh:

rj

2014-03-02 00:50:35

From: Flight
Yes there's always multiple ways to accomplish something like that. I believe in the beginning of the SRL-OSR that same method was applied for getting UpText, getting multiple TPA's of multiple colors then combining and filtering. It depends mostly on personal preference.

By the way, why are you using SplitTPA? :huh:



Is there a better way to split into ATPAs?

Flight

2014-03-02 01:02:36

From: Officer Barbrady
Is there a better way to split into ATPAs?


Thanks to Warpie we have ClusterTPA, much more efficient.

rj

2014-03-02 01:04:46

From: Flight
Thanks to Warpie we have ClusterTPA, much more efficient.


I like cluster TPA, I use it for most everything but I use splitTPA ex for just this because it works best for me I think i'll retry that though

slacky

2014-03-02 05:36:48

I see no real gains in using ClusterTPA, versus SplitTPAEx in this case.. The TPA is very small, and in such cases SplitTPAEx should be efficient.

Another way to read multicolored text (when the background darker then the text):

function GetSimpleText(x1,y1,x2,y2: Integer; Font:String; Modifier:Integer): String;
var BMP0,BMP1: Integer;
ATPA:T2DPointArray;
begin
BMP0 := BitmapFromClient(x1,y1,x2,y2);
BMP1 := BrightnessBitmap(BMP1, -100 + Modifier);
ThresholdAdaptiveBitmap(BMP1, 0, 255, False, TM_Mean, 0);
SetLength(ATPA, 1);
if FindColorsBitmap(BMP1, ATPA[0], 255) then
begin
ATPA := SplitTPAEx(ATPA[0], 1, 10);
Result := GetTextATPA(ATPA, 3, font);
end;
FreeBitmap(BMP0);
FreeBitmap(BMP1);
end;


begin
WriteLn(GetSimpleText(82,98,110,115, 'StatChars07', 0));
end.