Camaro'
2012-02-22 12:25:43
function FindWallBox(Click : Boolean): Boolean;
var
TPA: TPointArray;
ATPA: T2DPointArray;
I, X, Y: Integer;
TB : TBox;
begin
FindColorsTolerance(TPA, 15854581, MMX1, MMY1, MMX2, MMY2, 12);
ATPA := SplitTPAEx(TPA, 14, 19);
SortATPAFrom(ATPA, Point(MMCX, MMCY));
DebugATPABounds(ATPA);
for I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], X, Y);
TB := GetTPABounds(ATPA[i]);
writeln('w = '+tostr(tb.x2-tb.x1)+', h='+tostr(tb.y2-tb.y1)+'');
if (TB.x2 - TB.X1) < 25 then
continue;
if (TB.Y2 - TB.Y1) < 40 then
Continue;
if (PointInBox(Point(MMCX, MMCY), tb)) then
begin
Result := True;
if (Click) then
begin
Mouse(x, y, 5, 5, True);
FFlag(0);
end;
Writeln('True');
Exit;
end;
end;
end;
What i'm trying to do is detect if we are in a box (white walls on MM) but a lot of the time it its detecting things that aren't completely closed boxes. It works most of the time, but some times it will detect other things (like multiple walls close together that isn't a complete box). Can anyone give me some pointers on how I could go about writing this. Thanks.

This shows a false positive it gave me.
edit: I'm not even sure if thats debug from this function, but regardless, this function has given similar debug :)

