ok we are on the conditional programming road.
not so easy in Mach3 but with some tricks
example GCode:
#100=2
G1 X0 F500
M1234
M98 P#100 L1
M30
O1
G1X1 F500
M99
M30
%
O2
G1X2 F500
M99
M30
%
M98 subroutine call based on param #100 witch is set to 2 at the begining
M1234 will set it to 1 so O1 is excecuted.
within M1234 you can modify #100 however you want an call any programmed subroutine Oxx
M1234 code:
SetVar(100,2)
the macro call (M1234 or whatever) gives you all possibilties.
look for Inputs
do calculations
modify some other vars witch are used in the subroutine
And so on