Oh, one more thing. In your tool change mcs file, there are a lot of locals declared and initialized. There is a finite limit to the amount of local variables you can have in any one chunk. The default limit is 200 and we don't change it. Since all of the macro scripts are compiled into one chunk, you have to be careful with locals. It would be better to declare one local table in the m6 function.
function m6()
local inst = mc.mcGetInstance()
local rc
local vars = {
Alarm = mc.mcSignalGetHandle(inst, mc.OSIG_ALARM)
AlarmState = 0
RequestedTool = mc.mcToolGetSelected(inst)
CurrentTool = mc.mcToolGetCurrent(inst)
ToolChangePosition = mc.mcCntlGetPoundVar(inst, 500)
RequestedToolPocket = mc.mcToolGetData (inst, mc.MTOOL_MILL_POCKET, RequestedTool)
...
}
Then use them like vars.Alarm and vars.AlarmState, etc...
I have seen some strange thing happen when the declared local variables exceed the 200 count limit. And there is NO ERROR that says you have exceeded the limit! I found out the hard way.
Steve