Hello Guest it is April 18, 2024, 09:14:47 AM

Author Topic: LUA Script Error preventing start  (Read 603 times)

0 Members and 1 Guest are viewing this topic.

LUA Script Error preventing start
« on: March 06, 2021, 08:11:49 AM »
This is what happens when you get too clever...
I have successfully got Mach4 running and mastered the setup OK.
Then I added an MPG with LUA Script that I got from the Mach site.......
Initially it ran but was glitchy.....

    [the function that sets the axis will not set it to 'no axis' when axis switch is off - rather it sets it to the Y axis when the switch is off. Any ideas on this would be appreciated. I have triple checked the pins, the inputs, the code etc but simply cannot see why the 'if statement' will 'see' the X,Y & Z axes but not the final 'else' that says nothing is selected....but this is secondary.....]

Then I noticed one version of the LUA code included a call to the new MPG functions (axis, magnification and stop) in order to initialise the new script.
I foolishly added these calls ahead of the code that sets them up - instead of at the end of the script.
And now I get a fatal error no matter what profile I try to load. Mach4 simply will not load.
I have tried editing the 'screenscript.lua' file to remove the offending code, but on restart this file is rewritten with the code back in it - and Mach4 won't load.
I know I screwed up big time here! Any thoughts on how to get my Mach4 back very gratefully received!
Regards Simon
Re: LUA Script Error preventing start
« Reply #1 on: March 06, 2021, 09:06:08 AM »
You can force mach to open directly into the screen editor which will allow you to correct the error. Right click on your desktop shortcut that loads your Mach4 profile and select properties, in the Target box you should see /p "your profile name here" after this just add /e.

So it would look something like this..
Code: [Select]
"C:\Mach4Hobby\Mach4GUI.exe" /p Mach4Mill /e

Then just double click the shortcut as you would normally
Re: LUA Script Error preventing start
« Reply #2 on: March 06, 2021, 10:07:25 PM »
Many thanks for this tip. Saved me a lot of heartache! Just got to refine the LUA script for the MPG to stop it being permanently live to the Y axis! More head scratching tomorrow. Cheers Simon