
Originally Posted by
GOOGLE
So this is my last step I need to finish and I couldn't seen to find anything|tuts on this and its taking me about a week now so I'm going to ask for help. Im using the ACA tool to find the ladders colors and i need the function to actually climb down it.
Simba Code:
[CODE]function TrapDoorColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.20, 0.35);
FindColorsSpiralTolerance(MSCX, MSCY, arP, 6186359, MSX1, MSY1, MSX2, MSY2, 24);
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 <= 36.79) and (Y >= 2.82) and (Y <= 37.91) and (Z >= 2.39) and (Z <= 40.51) 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; [/CODE]
^ ACA autocolor function code for finding the color
This is how I'd do it:
Simba Code:
procedure FindLadder;
var
I, N, x, y: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.20, 0.35);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 6186359, MSX1, MSY1, MSX2, MSY2, 24); //Note here: Try to pick better colors, tolerance of 24 is quite high and you'll get a bunch of false positives
ATPA := (SplitTPAEx(TPA, 10, 10));
SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));
N := High(ATPA);
for I := 0 to N do
begin
MiddleTPAEx(ATPA[I], x, y);
Mouse(x, y, 2, 2, 3);
if IsUptext('adde') then
begin
Mouse(x, y, 2, 2, 1);
break;
end;
end;
end;
I might have made a syntax error or two, wrote this directly into the forum post, but that's the general idea.