I remember a while ago, I made a pixel shift procedure before for a woodcutter. I created TBox on the main screen and it would measure the pixel shift in that TBox.
Var MTB :Tbox;
Declares the TBox.
MTB.X1:= MSCX-100;
MTB.Y1:= MSCX-100;
MTB.X2:= MSCX+100;
MTB.Y2:= MSCX+100;
while (PixelShift(MTB, 1000) <= 4000) and (Not(InvFull)) and (TimeFromMark(O) < 60000) do Anti;
The MSCX is the man screen center point. So I'm creating a square around the center with all sides equal to 100. Then measures the the TBox, MTB, every 1000ms to see if it is still under 4000(Tolerance) so it can keep chopping. The rest is all infinite loop prevention stuff. Took me a while to post because I've seen faster rocks than my internet connection.