Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: Gerhard Grasser on August 03, 2014, 05:52:01 AM

Title: LUA Script - Please help me
Post by: Gerhard Grasser on August 03, 2014, 05:52:01 AM
Hello there,

i have a little problem. I tried to create a script.
What want I do, well very easy. I like to create 2 buttons in the FRO-Section.
The first button should increase the current FRO value by pushing +10.
The second button should decrease the current FTO value by pushing -10.

I tried out a lot, but currently I am not able to make it work.
Is anyone here who could help me?
Best regards,
Gerhard

Title: Re: LUA Script - Please help me
Post by: Gerhard Grasser on August 03, 2014, 07:36:10 AM
i tried out this:

local inst = mc.mcGetInstance();
local TempFRO = 0;
mc.mcCntlGetFRO(TempFRO, 0);
TempFRO = TempFRO - 10;
mc.mcCntlSetFRO(inst, TempFRO);


but it does not work.

Title: Re: LUA Script - Please help me
Post by: Gerhard Grasser on August 03, 2014, 07:56:06 AM
Now it works:

Decreasing FRO by Button:


local inst = mc.mcGetInstance();
local TempFRO;
TempFRO = mc.mcCntlGetFRO(inst);
TempFRO = TempFRO - 10;
mc.mcCntlSetFRO(inst, TempFRO);

Title: Re: LUA Script - Please help me
Post by: ger21 on August 03, 2014, 07:56:28 AM
I don't know Lua, but I think it should be something like this:

local inst = mc.mcGetInstance();
local TempFRO = 0;
mc.mcCntlGetFRO(inst);
TempFRO = TempFRO - 10;
mc.mcCntlSetFRO(inst, TempFRO);

Title: Re: LUA Script - Please help me
Post by: Analias on August 03, 2014, 09:57:16 AM
I did this by manipulating the slider.

I did a GetProperty() on the slider, did the math to add/subtract 5%, and then did a SetProperty() to update it.

I will post the code when I get to my computer.


-Freeman

Sent from my SGH-I337 using Tapatalk