Gucci
2012-03-21 18:47:08
Okay so I've gone through multiple finding functions excluding DTM's and my Maple Chopper still won't chop the maples. Here is the part of the code:
Thanks in advance for help
function MapleColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.07, 0.19);
FindColorsSpiralTolerance(MSCX, MSCY, arP, 1913182, MSX1, MSY1, MSX2, MSY2, 8);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 2.76) and (X <= 10.45) and (Y >= 2.21) and (Y <= 8.16) and (Z >= 0.88) and (Z <= 2.96) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
function FindMaple(x, y: Integer): Boolean;
var
CTS, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.07, 0.19);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, MapleColor, MSX1, MSY1, MSX2, MSY2, 8);
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 15, 15);
For I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 2, 2);
If(IsUpTextMultiCustom(['hop, aple, ree'])) then
begin
Result := True;
GetMousePos(x, y);
Break;
end;
end;
end;Thanks in advance for help