Hi,
if (mc.OSIG_OUTPUT24()==1)then
is wrong. You cannot read a signal directly like that. You have to get the signal handle then read the state of the memory location
indentifed by that handle.
hsig=mc.mcSignalGetHandle(inst,mc.OSIG_OUTPUT24)
local output24state=mc.mcSignalGetState(hsig)
if output24state==1 then
........
........
Craig