putonajonny
2011-12-03 17:59:02
Aims to do the same thing as the infight function but works by checking the hp of the closest HP bar and then checking your HP, if this is with the Tolerance then it returns true, if not it returns false:
{*******************************************************************************
function IsFighting(Tolerance : Integer);
By: putonajonny
Description: Returns True if you are in a fight, works by checking HP of nearby HP bars and comparing
that to your HP, should have less false positives than InFight.
*******************************************************************************}
function IsFighting(Tolerance : Integer) : Boolean;
var
Hits : TIntegerArray;
HP : Integer;
begin
Result := False
Hits := GetHitsIn(253, 99, 0, 0, 764, 502);
if GetArrayLength(Hits) = 0 then
Exit;
HP := HPPercent
Result := ((HP-Tolerance) < Hits[0]) and ((HP+Tolerance) > Hits[0]);
if (GetArrayLength(Hits) > 1) and (not Result) then
Result := ((HP-Tolerance) < Hits[1]) and ((HP+Tolerance) > Hits[1]);
end;