Sjoekeloe pretty much got it
I'll reiterate what he said, with the addition of it being a code example:
(look for code comments)
Simba Code:
procedure RedShifter();
var
i, MidX, MidY: Integer;
Shifter1TPA, Shifter2TPA: TPointArray;
ShifterATPA: T2DPointArray;
ShifterBox: TBox;
begin
FindColorsTolerance(Shifter1TPA, 1781205, MSX1, MSY1, MSX2, MSY2, 5);
if (Length(Shifter1TPA) < 1) then
Exit;
SplitTPAExWrap(Shifter1TPA, 30, 30, ShifterATPA);
SortATPAFrom(ShifterATPA, Point(MSCX, MSCY));
for i := 0 to high(ShifterATPA) do
begin
ShifterBox := GetTPABounds(ShifterATPA[i]);
FindColorsTolerance(Shifter2TPA, 4610426, Shifterbox.x1, Shifterbox.Y1, Shifterbox.X2, Shifterbox.Y2, 15);
if (Length(Shifter2TPA) < 1) then // Make sure we have another TPA to work with, before trying to go out of range ;)
Continue;
MiddleTPAEx(Shifter2TPA, MidX, MidY);
MMouse(MidX, MidY, 2, 2); // Clicks the middle of the TPA, instead of the x1,y1
if WaitUpText('ttack', 160) then
begin
ClickMouse2(Mouse_Left);
Wait(RandomRange(1500, 3900));
Break; // Stop when we've accomplished the goal for the procedure.
end;
end;
end;
Cheers,
Lj