Well, I cannot figure this out so far, but I am still working on it......
this does NOT work, but I have not figured out what is wrong with it yet
Something to do with mcMotorSetStill being nil I suspect, but I barely know what I am doing here....
---------------------------------------------------------------
-- Start of P&W Mill additions
---------------------------------------------------------------
function TogWayOil()
local still, rc = mc.mcMotorIsStill(inst, mc.MOTOR0)
local mcMotorSetStill(inst, mc.MOTOR0, 0) --Get the state if MOTOR0 is moving
if(still == 0) then
local hsig, rc = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT4)
mc.mcSignalSetState(hsig, 1) --sets OSIG_OUTPUT4 to True
else
local hsig, rc = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT4)
mc.mcSignalSetState(hsig, 0) --sets OSIG_OUTPUT4 to False
--- THIS CODE MAY TURN OFF THE OILER EVEN IF IT WAS TURNED ON WITH M CODE OR BUTTON!------
end
end
---------------------------------------------------------------
-- End of P&W Mill additions
---------------------------------------------------------------
I know if I ever get this working that I have to make some mods somewhere to keep it from turning off the oil if it was manually turned on with a button or M-Code. That is why I made that note there, but I have to get it working before I can look into that.