SCAR Code:
function FindYew(var x, y: integer): Boolean;
var
Points: TPointArray;
I, Ci, Tol: Integer;
begin
repeat
if FindMSColorTol(x, y, 598048, Tol) then Break else Tol := Tol +2
until Tol > 15
if Tol > 15 then
begin
Result := False;
exit;
Tol := 0
end else
begin
FindColorsSpiralTolerance(MSCX, MSCY, Points, 598048, MSX1 + 50, MSY1 + 30, MSX2 - 50, MSY2 - 50, tol)
ci := 0;
for I := 1 to GetArrayLength(Points) - 1 do
begin
if (Distance(Points[ci].x, 0, Points[i].x, 0) >= 2) and
(Distance(0, Points[ci].y, 0, Points[i].y) >= 2) then
ci := I
else
begin
Points[I].x := 0;
Points[I].y := 0;
end;
end;
for i := 0 to GetArrayLength(Points) - 1 do
begin
if (Points[i].x <> 0) then
if FindColorTolerance(x, y, 2373688, Points[i].x -5, Points[i].y -5, Points[i].x +5, Points[i].y +5, 5 +Tol) then
if FindColorTolerance(x, y, 4159600, Points[i].x -5, Points[i].y -5, Points[i].x +5, Points[i].y +5, 5 +Tol) then
if FindColorTolerance(x, y, 2900024, Points[i].x -5, Points[i].y -5, Points[i].x +5, Points[i].y +5, 5 +Tol) then
begin
//TempColor := GetColor(Points[i].x, Points[i].y); This is 1 thing i use to see if the Yew is gone.. Don't know if you gonne use it..
MMouse(Points[i].x, Points[i].y, 0, 0)
Wait(50);
if (IsUpText('Yew')) then
begin
WriteLn('Yew found at a Tol of ' +IntToStr(Tol));
Result := True;
Break;
end;
end;
end;
if (Result) then
begin
x := Points[i].x;
y := Points[i].y;
//TreeX := x; Also an extra failsafe, don't know if you wanna use it
//TreeY := y; Same as above..
end;
end;
Tol := 0;
end;