I usually just make a 10 by 10 box around the pixel i clicked on the tree, get the color of the pixel and then continually search for it in the box, have a timeout if nothing is added to the inventory etc.
something such as this:
SCAR Code:
Function FollowPixelBox(Point: TPoint): Boolean;
var
i: LongInt;
col, tempCount: Integer;
x, y: Integer;
begin
Col := GetColor(Point.x, Point.y);
WriteLn('Tree Color = '+IntToStr(Col));
i := GetSystemTime;
tempCount := InvCount;
while FindColorTolerance(x, y, Col, Point.x-10, Point.y-10, Point.x+10, Point.y+10, 15) do
begin
FindNormalRandoms;
Wait(150+random(100));
if (GetSystemTime-i > RandomRange(25000, 50000)) then
Break;
if InvFull then Break;
if InvCount <> TempCount then
begin
i := Getsystemtime;
tempCount := InvCount;
end;
end;
Result := True;
end;
when the color is gone, the tree is gone