Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: Bill_O on September 28, 2018, 10:05:03 AM

Title: coding help
Post by: Bill_O on September 28, 2018, 10:05:03 AM
Ok i am finally back to working on the Mach4.
I am having a problem with what i thought was a simple code.
I do not want to use the sliders for speed adjustments so i made a button to increase and one to decrease the FRO.
When i click the button the DRO flicks the change then immediately back to what it started at.
Here is the code.

local val = scr.GetProperty('droCutSpeed', 'Value');
val = tonumber(val) + 10;
local maxval = 300
if (tonumber(val) >= tonumber(maxval)) then
 val = maxval;
end
scr.SetProperty('droCutSpeed', 'Value', tostring(val));

I am sure it is something simple i am missing but I have no idea what.
Thanks,
Bill
Title: Re: coding help
Post by: Cbyrdtopper on September 28, 2018, 10:10:30 AM
Bill,
There are already buttons to adjust the FRO. 
But you can use the code in this post below, see if it works. 

http://www.machsupport.com/forum/index.php/topic,38406.0.html
Title: Re: coding help
Post by: Bill_O on September 28, 2018, 10:50:58 AM
I will definitely look at that code.
I have other code i will need to write so if you have any idea why mine doesnt keep the change in the dro it would be helpful to me.

Bill
Title: Re: coding help
Post by: SwiftyJ on September 30, 2018, 02:41:47 PM
If you replace your scr.GetProperty and scr.SetProperty commands with the API calls mc.mcCntlGetFRO and mc.mcCntlSetFRO your code will work
Title: Re: coding help
Post by: Bill_O on October 02, 2018, 08:47:40 AM
Swifty,

Thanks for the assistance.

Bill