This could be a little over-the-top, but I'm bored so… :p I use this function when I'm dealing with fires:
function FindFire(Color, Min: TIntegerArray; UseItem: Integer; Strict: Boolean): Boolean;
var
Found, Tol, t, i: Integer;
P: TPoint;
Temp1, Temp2: TPointArray;
TPA, ATPA: T2DPointArray;
begin
Result := False;
for Tol := 10 to 20 do
begin
Found := 0;
for i := 0 to High(Color) do
begin
Writeln('Searching for fire: Tolerance is '+ ToStr(Tol) +'...');
FindColorsTolerance(Temp1, Color[i], MSX1, MSY1, MSX2, MSY2, Tol);
if (Length(Temp1) >= Min[i]) then
begin
SetLength(TPA, Found + 1);
TPA[Found] := Temp1;
Inc(Found);
end;
end;
if Strict then
begin
if (Found >= Length(Color)) then
Temp2 := MergeATPA(TPA)
else
Break;
end else
begin
if (Found >= 1) then
Temp2 := MergeATPA(TPA)
else
Break;
end;
ATPA := TPAToATPAEx(Temp2, 40, 40);
SortATPASize(ATPA, True);
for t := 0 to High(ATPA) do
begin
P := MiddleTPA(ATPA[t]);
if (UseItem <> 0) then
begin
if not ItemActivated(UseWith) then
MouseItem(UseWith, mouse_left);
Wait(200+Random(100));
end;
Mouse(P.x, P.y, 3, 3, mouse_right);
Result := WaitOption('ire', 1000);
if Result then
begin
Wait(500+Random(250));
while IsMoving do
Wait(200);
Exit;
end;
if (t >= 2) then
Break;
end;
end;
end;
It allows for multiple colors. If you wanted to use it to find a fire made from oak logs, you could use it like this:
if FindFire([5210365, 7257851, 8036535], [8, 4, 4], RandomRange(2, 8), True) then
begin
// ...