What part of the program is not working? The main reason the #1033 and #4120 are in there is so that if you are calling a tool that is already in the spindle then it will bypass the M6 command. So to try out the code you can remove these and do a tool call. Just make sure every time you call a tool it is not the same one that is in the spindle. This will help you at least prove out the positioning and M6 ect. until we find the parameter for the tool in the spindle

Yes that is parameter 1033. These are the input signals. I cannot write to #1033 this gets set every time the tool changes. So I can read from it. This is not going to be in your Fanuc manual this will be in your MTB manual. I am pretty sure that these are the same input/output numbers on the OM control so we should be able to find the one that tracks your tool(there should be one, I hope). So there are a few things that you can do to try and find the parameter that is tracking the tool.

The input/output parameters are as follows:
#1000-#1035 input
#1100-#1135 output

So if you run this program
#1=0
#2=0
WHILE[#1LT35]DO1
#[100+#2]=#[1000+#2]
#[136+#2]=#[1100+#2]
#1=#1+1
#2=#2+1
END1
M30

Now your common variables #100-#135 are set to #1000-#1035 in sequential order. #136-#171 are set to #1100-#1135. Look at the variables and see if any one of them are set to the current tool in the spindle. If so then do a tool change to a different tool number and run the program again. If it is the same variable that changed to the tool in the spindle you have found your tool tracking parameter.

Stevo