Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: daniba73 on November 07, 2018, 01:57:22 AM
-
Hello to the whole forum.
I'm italian, I use google translate.
I would like to assign an external key to the SINGLE BLOCK function, then an Input for the controller.
how can I do?
I own CSMIO-IP / S
thank you.
-
daniba73,
Once you map a button to an input in Mach4 then you can put this script into the signal library in the screen load script.
I have this example mapped to input 5
[mc.ISIG_INPUT1] = function (state)
if (state == 1) then --
--Single Block Toggle Test
local inst = mc.mcGetInstance()
local SBMode = mc.mcCntlGetSingleBlock(inst)
if SBMode == 1 then
mc.mcCntlSetSingleBlock(inst, 0)
else
mc.mcCntlSetSingleBlock(inst, 1)
end
end
end,
-
Hi,
Yes, it works
part immediately active.
can you do it reverse?
-
Daniba73,
It toggles correctly?
You can reverse the logic, yes.
[mc.ISIG_INPUT1] = function (state)
if (state == 1) then --
--Single Block Toggle Test
local inst = mc.mcGetInstance()
local SBMode = mc.mcCntlGetSingleBlock(inst)
if SBMode == 0 then
mc.mcCntlSetSingleBlock(inst, 1)
else
mc.mcCntlSetSingleBlock(inst, 0)
end
end
end,
-
Hi,
toggles correctly.
thanks you have been very kind!!
-
So it works like you want now?
-
Yes,Yes!
Very good!
thank you again!
P.S. I would like to add some sounds to Mach4, but I open a dedicated topic.
-
Note:
with the second code, it did not work for me.
I'm using the first one.
Mach4 boot active part, but it is not a problem.