Alright, well bear with me, I'll make a few assumptions then:
(ex. like trying to find the pixel shift over the best box)
But I think this code is what you are trying to do/find, no?
If you want to save the coords of the changed box, you can in the last for loop, as that loop iterates through the potential shifts on the main screen for your result.
Simba Code:
function FindTPAShift(TimeOut: Integer): Boolean;
var
i, TempCTS: Integer;
OldHue, OldSat: Extended;
TIA: TIntegerArray;
TPA: TPointArray;
TBA: TBoxArray;
ATPA: T2DPointArray;
begin
result := false;
GetColorSpeed2Modifiers(OldHue, OldSat);
TempCTS := GetColorToleranceSpeed();
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.28, 0.60);
FindColorsTolerance(TPA, 6453124, MSX1, MSY1, MSX2, MSY2, 14);
SetColorSpeed2Modifiers(OldHue, OldSat);
SetColorToleranceSpeed(TempCTS);
SplitTPAWrap(TPA, 10, ATPA);
SortATPASize(ATPA, true);
SetArrayLength(TBA, Length(ATPA));
for i := 0 to high(ATPA) do
TBA[i] := GetTPABounds(ATPA[i]);
SetArrayLength(TIA, Length(ATPA));
TIA := PixelShiftMulti(TBA, TimeOut);
for i := 0 to high(TIA) do
if (TIA[i] > 25) then
begin
result := true;
break;
end;
end;
Basic idea is that this function finds your TPA,
Splits the TPA into an ATPA,
Filters the ATPA by best 1st,
Makes a box for each each ATPA element,
Searches for pixel shift in each of the ATPA's,
then filters through the shift results, and resulting true if one is over 25 pixels.
Edit: Could be re-used too if you wanted with other objects, given you add the specifications into the arguments (maybe even as a custom object type?

)
Cheers,
-Lj