Anyone have a premade function(boolean) that results true if any HP bars are found on the screen?
The one in SRL doesn't work for right before the enemy dies and the HP bar is all red, I need one that accounts for that.
Anyone have a premade function(boolean) that results true if any HP bars are found on the screen?
The one in SRL doesn't work for right before the enemy dies and the HP bar is all red, I need one that accounts for that.
I'm gonna make a simple bitmap searching function for my own script in a sec, I'll share with ya when I'm done.
Fix the SRL one so it takes it into account?
SRL's F.A.Q. (Error fixes) | How to Convert SRL-5 Scripts to SRL-6 | Draynor Chop N' Bank (RS3)| AIO Superheater (RS3)
T - E - A - MTogether Everyone Achieves More
Here:
Simba Code:Function HPExists: Boolean;
var
HP: integer;
begin
HP := BitmapFromString(56, 1, 'meJxjYrdmYMhhYGgCIkaGLgw0iZl' +
'hFjJiYVgIR6wMq+CIg2EjDO3EhTgZDgARhIFHGQZazcRuDQB2WiWA');
Result := FindBitmap(HP, x, y);
end;
The green outline and red outline are both constant colors. Just do a tpa search.
I use this to find if they are dead(TPoint of the middle of the tracked npc).
Simba Code:function FindDeath(P: TPoint): Boolean;
var
TPA: TPointArray;
ATPA: T2DPointArray;
B, tB: TBox;
Len, i, Dist: Integer;
begin
Result := False;
if not LoggedIn then Exit;
B := IntToBox(P.x - 45, P.y - 55, P.x + 45, P.y + 20);
if (B.X1 < MSX1) then B.X1 := MSX1;
if (B.Y1 < MSY1) then B.Y1 := MSY1;
if (B.X2 > MSX2) then B.X2 := MSX2;
if (B.Y2 > MSY2) then B.Y2 := MSY2;
if FindColorsSpiralTolerance(MSCX, MSCY, TPA, 132923, B.X1, B.Y1, B.X2, B.Y2, 0) then
begin
ATPA := SplitTPA(TPA, 10);
SortATPASize(ATPA, True);
if not (Length(ATPA) > 0) then Exit;
for i := 0 to High(ATPA) do
begin
Len := Length(ATPA[i]);
if (Len > 0) then
begin
tB := GetTPABounds(ATPA[i]);
Dist := Distance(tB.X1, tB.Y1, tB.X2, tB.Y2);
m_Debug('HP bar dist: ' + ToStr(Dist), False);
Result := (Dist > 54);
if Result then
begin
if Debug then
begin
SMART_DrawBoxEx(False, B, clBlue);
SMART_DrawBoxEx(False, GetTPABounds(ATPA[i]), clWhite);
end;
Exit;
end;
end;
end;
end;
end;
@Marpis, thanks.
@Cohen yeah I would, now that I know that green/red of HP are constant I'll maybe make one. I don't feel like I'd make it as 'perfect' as a more able scripter even though it's easy to do.
Simba Code:Function YoHoIsFightAt: Boolean;
var
arP: TPointArray;
tmpCTS: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(5.33, 1.31);
FindColorsSpiralTolerance(MMCX, MMCY, arP, 78384, MSX1, MSY1, MSX2, MSY2, 3);
WriteLn(Length(Arp));
If Length(arP) > 30 Then
Result:=True;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
End;
That works. Just find ANY HP bars on the mainscreen.
Simba Code:SetColorSpeed2Modifiers(5.33, 1.31);
FindColorsSpiralTolerance(MMCX, MMCY, arP, 78384, MSX1, MSY1, MSX2, MSY2, 3);
Is the main part that just fins the HP bar colors. Edit/use it however you wish.
You really really really don't need to do that. I'm going to revamp my procedure tomorrow to find HPPercent instead of just checking for the length(this will include finding the green outline as well, plus a better splitting of the tpa). I'll post it here when i'm done.
Am not sure what you need it for, but I had a function that will check if an player/monster that is in fight by checking if an hp bar is within certain range (varies depends on its location on rs screen as well!).
Oh Hai Dar
There are currently 1 users browsing this thread. (0 members and 1 guests)