SRL Archive - SRL Archives

InFight for new HP bars


marpis

2009-05-28 16:29:07


function IsInFight(x, y: integer): Boolean;
var
fx, fy, i: integer;
HPBar: array [0..2] of integer;
begin
HPBar[0] := BitmapFromString(4, 5, 'beNo7xMCgCUKZuxgiT4EYzWdB' +
'aPFVELvlGIix8CyUDRSHsBnUGUoOMyQDABiPEhA=');
HPBar[1] := BitmapFromString(4, 5, 'beNrjYF7KwAFENhzMQHSdl/sg' +
'IxeEu4uBE4jWMHAC2ZsYOIEIIt7NwAREEWysNgBgTgtI');
HPBar[2] := BitmapFromString(4, 5, 'beNrTZJCeDEIMmiAUvY+BbxYI' +
'Adk6mxlMtjCw9oHYoqsY2CaCEJANFIEwGABMSQpW');
for i := 0 to 2 do
begin
if FindBitmapToleranceIn(HPBar[i], fx, fy, x-40, y-30, x+40, y+30, 8) then
result := true;
if result then break;
end;
for i := 0 to 2 do
FreeBitmap(HPBar[i]);
end;


function InFight: boolean;
begin
result := IsInFight(MSCX, MSCY-20);
end;
Not laggy and works nicely

edit: could someone try this wearing dragon armor?

Nava2

2009-05-29 23:37:30

Aren't the colors static?

Rich

2009-05-29 23:48:36

From: Nava2
Aren't the colors static?
Yup.

footballjds

2009-05-30 00:17:52

rename isinfight –> InFightEx

;)

marpis

2009-05-30 01:09:10

From: Nava2
Aren't the colors static?


im not that good in english, so does 'static' mean that the colors change or that they always stay the same?

even if they were always the same, the same colors could maybe be found in the environment. bitmaps are 100% accurate, so i don't see any point in doing this with pure color.

ShowerThoughts

2009-05-30 01:11:10

Static they don't change.
Dynamic they do change.;)

Nadeem

2009-05-30 01:18:12

From: marpis
even if they were always the same, the same colors could maybe be found in the environment. bitmaps are 100% accurate, so i don't see any point in doing this with pure color.


Colors are more faster I believe, and don't use as much memory as bitmaps :P

Nevertheless, nice update :)


~NS

ShowerThoughts

2009-05-30 01:28:38

Those small bitmaps won't hurt. ;)

Da 0wner

2009-05-30 03:59:13

Bitmaps are really fast in SCAR 3.20+.

Cazax

2009-05-30 05:06:22

Like Nava said, don't they have static colors? why are you using bitmap finding with tolerance then? And I've already made this with pure color finding(check my post in Skill section).

marpis

2009-05-31 01:49:56

From: Cazax
Like Nava said, don't they have static colors? why are you using bitmap finding with tolerance then? And I've already made this with pure color finding(check my post in Skill section).


i tested it now, it doesnt find any of the bitmaps with 0 tolerance. 2, however, is enough

Naike

2009-05-31 02:15:30

This is already fixed, and FindColor is faster ;)

N2 Edit: Closed…