Trying to set a #Variable value by a script in a button. As per the Mach4 Scripting Manual, I have created this function in the ScreenLoad Script:
function WriteRegister(regname, regvalue)
local inst = mc.mcGetInstance()
local hreg = mc.mcRegGetHandle(inst, string.format("#Variables/%s", regname))
mc.mcRegSetValueString(hreg, tostring(regvalue))
end
And in the buttin script I have this:
WriteRegister("#1", 15)
However, clicking the button doesn't change the value of #1 to 15. Following the example above, tried change iRegs0 and Sim0 register values and it worked fine, but not with #Variables. How should it be done?
Dan