Kyle
2013-04-07 00:33:29
So, i's still fairly new to ATPA's and I get an out of range error sometimes of this snippet. Anyone have any idea? Please and thanks in advance!
Procedure RedShifter;
var
Shifter1TPA, Shifter2TPA:TPointArray;
ShifterATPA:T2DPointArray;
ShifterBox:TBox;
i:integer;
MSCTP:Tpoint;
begin
MSCTP := Point(MSCX, MSCY);
if findcolorstolerance(Shifter1TPA, 1781205, MSX1, MSY1, MSX2, MSY2, 5) then
begin
ShifterATPA := SplitTPAEx(Shifter1TPA, 30, 30);
SortATPAFrom(ShifterATPA, MSCTP);
for i := 0 to high(ShifterATPA) do
begin
ShifterBox := GetTPABounds(ShifterATPA[i]);
if findcolorstolerance(Shifter2TPA, 4610426, Shifterbox.x1, Shifterbox.Y1, Shifterbox.X2, Shifterbox.Y2, 15) then
begin
mmouse(Shifter2TPA[i].x, Shifter2TPA[i].y,2,2);//OUT OF RANGE ON THIS LINE!
if WaitUpText('ttack', 160) then
begin
clickmouse2(mouse_left);
wait(RandomRange(1500,3900));
end;
end;
end;
end;
end;