Hey guys I was wondering if you guys could help me decipher the code from the ACA program.
This is the code from my kyatt program.
As you can see, I used 'cycle' to cycle through the various possible colors instead of putting them into an array. If you guys have any suggestions any improvements to this or if its fine as it is to achieve that function.Code:function FindClimb: Boolean; var arP: TPointArray; ararP: T2DPointArray; tmpCTS, i, arL: Integer; Colors : Array of Integer; P: TPoint; begin Cycle := 0; Repeat tmpCTS := GetColorToleranceSpeed; ColorToleranceSpeed(2); SetColorSpeed2Modifiers(0.00, 0.00); Case Cycle of 0: begin if not(FindColorsTolerance(arP, 855310, MSX1, MSY1, MSX2, MSY2-75, 1)) then begin Debugger('Failed to find the color, no object found. 0'); ColorToleranceSpeed(tmpCTS); SetColorSpeed2Modifiers(0.2, 0.2); end; end; 1: begin if not(FindColorsTolerance(arP, 789517, MSX1, MSY1, MSX2, MSY2-75, 1)) then begin Debugger('Failed to find the color, no object found. 1'); ColorToleranceSpeed(tmpCTS); SetColorSpeed2Modifiers(0.2, 0.2); end; end; 2: begin if not(FindColorsTolerance(arP, 855309, MSX1, MSY1, MSX2, MSY2-75, 1)) then begin Debugger('Failed to find the color, no object found. 2'); ColorToleranceSpeed(tmpCTS); SetColorSpeed2Modifiers(0.2, 0.2); Exit; end; end; end; SortTPAFrom(arP, Point(MSCX, MSCY)); ararP := SplitTPAEx(arP, 10, 10); arL := High(ararP); for i := 0 to arL do begin if (Length(ararP[i]) < 20) then Continue; P := MiddleTPA(ararP[i]); HumanMMouse(P.x, P.y, 5, 5); Wait(100 + Random(100)); if (IsUpText('Climb')) then begin; Result := True; Exit; end; end; ColorToleranceSpeed(tmpCTS); SetColorSpeed2Modifiers(0.2, 0.2); if (i = arL + 1) then begin Debugger('FindClimb could not find object. Cycle: ' + IntToStr(Cycle)); end; Cycle := Cycle + 1; Until ( Cycle = 3 ) Result := False; end;
My main confusion is the
I can select the 'max length' in the ACA function maker and I can see it translates to [if (Length(ararP[i]) < 20) then Continue;]Code:SortTPAFrom(arP, Point(MSCX, MSCY)); ararP := SplitTPAEx(arP, 10, 10); arL := High(ararP); for i := 0 to arL do begin if (Length(ararP[i]) < 20) then Continue; P := MiddleTPA(ararP[i]); HumanMMouse(P.x, P.y, 5, 5); Wait(100 + Random(100)); if (IsUpText('Climb')) then begin; Result := True; Exit; end; end;
Is this a way to ignore the random single pixels that might have matching colors from the findcolortolerance or is it something completely different?
Thanks!


Reply With Quote






