SRL Archive - Help and Support

MiniMap Hp Checker?


Trifonius

2008-01-27 16:24:07

Hi,

Has anyone made a MinimapHpChecker ?
I searched the forums, but didn't find a function that gets the job done.

I've tried to make it myself, but this does not seem to work:
GetTextAtEx( 756, 26, 50, TradeChars, True, False, 0, 1, 1, 4, False, tr_Digits)
It's the first time I try to use the GetTextAtEx function, I don't know if I use it correctly.

Thx!
-Trifonius

Santa_Clause

2008-01-27 16:26:09

{*******************************************************************************
function Function GetMMLevels(LevelType : String;var ColorSign : String): integer;
By: Raymond
Description: Returns the level shown next to the minimap.
Colorsign returns the color of the text (Green,Yellow,Orange,Red).
Returns -1 if failed.
*******************************************************************************}

Function GetMMLevels(LevelType : String;var ColorSign : String): integer;
var
TP : TPoint;
I,x,y : Integer;
Colors : TIntegerArray;
Signs : TStringArray;
begin;
Result := -1;
ColorSign := '';
Case LowerCase(Leveltype) of
'health','hp','hitpoints' : TP := Point(729,29);
'prayer','pray' : TP := Point(746,68);
'run' : TP := Point(740,107);
else
begin;
Writeln('Wrong leveltype.');
Exit;
end;
end;
Colors := [65280,65535,2070783,255];
Signs := ['Green','Yellow','Orange','Red'];
For I := 0 to 3 do
if FindColor(x,y, Colors[I], TP.x,TP.y,TP.x + 30,TP.y + 10) then
Break;
if (I > 3) then
Exit;
Result := StrToIntDef(GetNumbers(GetTextAtEx(x - 10, y-1,0, StatChars,False,False,0,0,Colors[I],50,False, tr_AllChars)), -1);
if Result < 10 then
Result := Max(Result,StrToIntDef(GetNumbers(GetTextAtEx(x - 9, y-1,0, StatChars,False,False,0,0,Colors[I],50,False, tr_AllChars)), -1));
if Result < 10 then
Result := Max(Result,StrToIntDef(GetNumbers(GetTextAtEx(x - 8, y-1,0, StatChars,False,False,0,0,Colors[I],50,False, tr_AllChars)), -1));
if Result < 10 then
Result := Max(Result,StrToIntDef(GetNumbers(GetTextAtEx(x - 9, y-1,0, StatChars,False,False,1,0,Colors[I],50,False, tr_AllChars)), -1));
If Result < 0 then
Exit;
ColorSign := Signs[I];
end;

Core/Gametab.

Trifonius

2008-01-27 16:42:36

/Shame
/Shame
/Shame
/Shame
/Shame
…

Thanks for the answer!

t3hl33tn00b

2008-01-28 07:09:53

From: Trifonius
/Shame
/Shame
/Shame
/Shame
/Shame
…

Thanks for the answer!


your sig makes me want to kill myself, that show is so gay…

anyways, its ok, at least you tried a simple command rather than just coming here and saying " o em gee i nid mm hp reder plz"

ZephyrsFury

2008-01-28 08:51:02

From: Santa_Clause
{*******************************************************************************
function Function GetMMLevels(LevelType : String;var ColorSign : String): integer;
By: Raymond
Description: Returns the level shown next to the minimap.
Colorsign returns the color of the text (Green,Yellow,Orange,Red).
Returns -1 if failed.
*******************************************************************************}

Function GetMMLevels(LevelType : String;var ColorSign : String): integer;
var
TP : TPoint;
I,x,y : Integer;
Colors : TIntegerArray;
Signs : TStringArray;
begin;
Result := -1;
ColorSign := '';
Case LowerCase(Leveltype) of
'health','hp','hitpoints' : TP := Point(729,29);
'prayer','pray' : TP := Point(746,68);
'run' : TP := Point(740,107);
else
begin;
Writeln('Wrong leveltype.');
Exit;
end;
end;
Colors := [65280,65535,2070783,255];
Signs := ['Green','Yellow','Orange','Red'];
For I := 0 to 3 do
if FindColor(x,y, Colors[I], TP.x,TP.y,TP.x + 30,TP.y + 10) then
Break;
if (I > 3) then
Exit;
Result := StrToIntDef(GetNumbers(GetTextAtEx(x - 10, y-1,0, StatChars,False,False,0,0,Colors[I],50,False, tr_AllChars)), -1);
if Result < 10 then
Result := Max(Result,StrToIntDef(GetNumbers(GetTextAtEx(x - 9, y-1,0, StatChars,False,False,0,0,Colors[I],50,False, tr_AllChars)), -1));
if Result < 10 then
Result := Max(Result,StrToIntDef(GetNumbers(GetTextAtEx(x - 8, y-1,0, StatChars,False,False,0,0,Colors[I],50,False, tr_AllChars)), -1));
if Result < 10 then
Result := Max(Result,StrToIntDef(GetNumbers(GetTextAtEx(x - 9, y-1,0, StatChars,False,False,1,0,Colors[I],50,False, tr_AllChars)), -1));
If Result < 0 then
Exit;
ColorSign := Signs[I];
end;

Core/Gametab.


Do I see a bug with this function?


For I := 0 to 3 do
if FindColor(x,y, Colors[I], TP.x,TP.y,TP.x + 30,TP.y + 10) then
Break;
if (I > 3) then
Exit;

Will 'I' ever be greater than 3? Shouldn't it be for I := 0 to 4 or something like that?

EDIT: Or better still:

for i := 0 to 4 do
begin
if (i > 3) then Exit;
if FindColor(x,y, Colors[I], TP.x,TP.y,TP.x + 30,TP.y + 10) then
Break;
end;

mastaraymond

2008-01-28 08:59:40

From: ZephyrsFury
Do I see a bug with this function?


For I := 0 to 3 do
if FindColor(x,y, Colors[I], TP.x,TP.y,TP.x + 30,TP.y + 10) then
Break;
if (I > 3) then
Exit;

Will 'I' ever be greater than 3? Shouldn't it be for I := 0 to 4 or something like that?

EDIT: Or better still:

for i := 0 to 4 do
begin
if (i > 3) then Exit;
if FindColor(x,y, Colors[I], TP.x,TP.y,TP.x + 30,TP.y + 10) then
Break;
end;


Nope try it.. (I recently found this out to, nielsie told me ;) )

program Hoi;
var
I : integer;
begin
For I := 0 to 3 do // ; is enough..
begin;
end;
Writeln(inttostr(I));
end.

ZephyrsFury

2008-01-28 09:25:55

Oh right…. I learnt something new :)

Trifonius

2008-01-28 19:20:36

From: t3hl33tn00b
your sig makes me want to kill myself, that show is so gay…


That show IS gay indeed!
BUT: The first 15 minutes of the first episode (the only one I watched) is all about food… It makes no f-ing sense! And things that make no sense at all and make me laugh, especially if it goes on for 15 minutes. And also, I like their little dance, it's cute :p DON'T JUDGE ME! ^^

Timothegreat

2008-01-28 20:25:53

{*******************************************************************************
function GetHp: Integer;
By: Timothegreat
Description: Returns Hp left as an integer
*******************************************************************************}

function GetHp: Integer;
var
T: TPoint;
TmpResult: string;
i,f: Integer;
begin
tmpResult := GetTextAtEx(728, 29, 100, StatChars, False, True, 0,
5, -1, 2, True, tr_Digits);
if (Trim(tmpResult) = '') then
begin
for i := 1 to 5 do
begin
tmpResult := GetTextAtEx(728 + i, 29, 100, StatChars, False,
True, 0, 5, -1, 2, True, tr_Digits);
if (Trim(tmpResult) <> '') then
Exit;
end;
end else
Result := StrToIntDef(Trim(GetTextAtEx(728, 29, 100, StatChars,
False, True, 0, 5, -1, 2, True, tr_Digits)), 0);
end;