6
« on: February 04, 2020, 11:03:45 AM »
I have this function in my Screen Load Script:
----------
function SetSigState (sig,state)
local hSig = mc.mcSignalGetHandle (inst,sig)
mc.mcSignalSetState (hSig,state)
end
----------
It works like this in signal and button scripts:
--Example: local state = GetSigState(mc.OSIG_OUTPUT1)
SetSigState(mc.OSIG_OUTPUT1, 1) --turns on output 1
Or SetSigState(mc.ISIG_INPUT1, 0) set input 1 off
This is M code m111:
function m111()
local inst=mc.mcGetInstance()
mc.mcCntlSetLastError(inst, 'Test m111')
SetSigState(mc.OSIG_OUTPUT2, 0)
end
if (mc.mcInEditor() == 1) then
m111()
end
When I run it in the debugger I get the following error:
Debugging session started in 'C:\Mach4Hobby\Profiles\TBtest\Macros\'.
m111.mcs:6: attempt to call a nil value (global 'SetSigState')
stack traceback:
m111.mcs:6: in function 'm111'
m111.mcs:9: in main chunk
Debugging session completed (traced 6 instructions).
Program completed in 19.11 seconds (pid: 3412).
Any help would be appreciated. Thanks, Tony