You're right DazTheGas, I don't know why I didn't post it yesterday.
I was trying to get an Output to act like an Enable. It worked, but it messed up my cylcle time for some reason.
Here is the code that messed up my timer, it was in the signal library.
--Enable Signals
--MOVED THIS TO PLC SCRIPT CB 1-12-17
--It messed up the part timer. Timer works fine when this is in PLC Script.
--[mc.OSIG_MACHINE_ENABLED] = function (state)
-- if (state == 1) then
-- local inst = mc.mcGetInstance()
-- local RedLight = mc.mcSignalGetHandle (inst,mc.OSIG_OUTPUT11)
-- mc.mcSignalSetState(RedLight,0)
-- else
-- local inst = mc.mcGetInstance()
-- local RedLight = mc.mcSignalGetHandle (inst,mc.OSIG_OUTPUT11)
-- mc.mcSignalSetState(RedLight,1)
-- end
--end,
Here is the code to do the same thing, I put it in the PLC Script and now the "Enabled Output" works great and so does my Cycle Timer.
--Enable the Output
local sigh = mc.mcSignalGetHandle(inst, mc.OSIG_MACHINE_ENABLED);
local sigState = mc.mcSignalGetState(sigh);
if (sigState == 1) then
local inst = mc.mcGetInstance()
local RedLight = mc.mcSignalGetHandle (inst,mc.OSIG_OUTPUT3)
mc.mcSignalSetState(RedLight,0)
else
local inst = mc.mcGetInstance()
local RedLight = mc.mcSignalGetHandle (inst,mc.OSIG_OUTPUT3)
mc.mcSignalSetState(RedLight,1)
end