Hello Guest it is March 28, 2024, 04:18:27 AM

Author Topic: How can I edit lua script?  (Read 2785 times)

0 Members and 1 Guest are viewing this topic.

How can I edit lua script?
« on: February 05, 2018, 08:18:04 AM »
Hello everyone,

I've recently got into M4.
I studied for a couple weeks to customize M4.

I found something to change in lua script, but I can't edit it.
I could just VIEW it.... ;(

It's the script in the menu ---  "Operator > Lua Script"

What shall I do to edit this script?

I searched all in Mach4 directory... but in vain...

I absolutely need your help.....

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: How can I edit lua script?
« Reply #1 on: February 05, 2018, 08:26:52 AM »
This should help a little

https://youtu.be/wlYsRPjdnig

DazTheGas
New For 2022 - Instagram: dazthegas
Re: How can I edit lua script?
« Reply #2 on: February 05, 2018, 10:23:43 AM »
Hi DAZ,

What I exactly want to do is, to eliminate the highlighted part in the screen capture image.
(Or if there is no problem, I just want to eliminate from line 68 to 78.
I have my own M6 macro in my profile / Macro folder.
(I could do it with your video help. ;))

But I can't find where I should go and edit....


When I enter "T#(2,3....) M6" in the MDI, I always have to press Cycle Start MDI once more...
Mach pops up a message window, but I think this should not be popped up to run M6 in actual G-code.

« Last Edit: February 05, 2018, 10:25:52 AM by ysymidi »

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: How can I edit lua script?
« Reply #3 on: February 05, 2018, 03:06:42 PM »
That piece of code is in the screen load script, go into the screen editor and highlight the uppermost part of the tree in top left and then in the window below select the events icon and you should find the screen load script.

DazTheGas
New For 2022 - Instagram: dazthegas
Re: How can I edit lua script?
« Reply #4 on: February 05, 2018, 03:48:59 PM »
Hi,
Daz has got you pointed in the right direction.

I see the code that you want to delete to make your machine do what you want.

Sometimes I done a similar thing only to find it had some consequence I didn't think about and I wanted the code back. I find it best now instead of deleting
the code 'comment it out'. That means putting "--" at the start of each line you want to 'delete' and Mach will ignore that lie as a comment. Should at a later date
you want to get the code back or see how NFS did it, its still there for you to see.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: How can I edit lua script?
« Reply #5 on: February 05, 2018, 05:33:28 PM »
There are several ways to stop the messagebox from showing, there is a checkbox on the dialog that when checked it will not show again. You can also edit you profiles machine.ini file too

[ToolChangeSettings]
ToolChangeMsgBox=0

DazTheGas
New For 2022 - Instagram: dazthegas
Re: How can I edit lua script?
« Reply #6 on: February 05, 2018, 11:55:39 PM »
As you told me, I had thought I could have find the script among screen editor...

But I could not find it...

I think this is because M6 command is not performed via Click Button on the screen but manual input command in MDI.
So... it's natural that I could not find the script where I can edit to eliminate the msg box.



The second way you told me is the same I check on "Don't show me again" box on the pop up message.
This just doesn't show the box, but I still have to click "Cycle start" again.


This is the problem... because if I put in MDI as follows, tool change does not start, but jump to the next command.


T2 M6
G0 Z0


If it works properly, Mach4 should run toolchange then g0 z0, but now Mach4 just G0 Z0 then shows me the message box(or shows nothing(just hiding the box... like... there is an invisible box.... still have to cycle start once more...)
Re: How can I edit lua script?
« Reply #7 on: February 06, 2018, 01:05:07 AM »
Hi,
the code IS in the screen load script. It is  the last entry in the signal library. I noted that your screenshot showed the Lua script, which is useful for see the
complete picture, but you need to edit the screen load script.

It is not in fact anything to do with the toolchange. All it does is define a certain action to take if a certain signal changes state, the signal is OSIG_TOOL_CHANGE

The toolchange macro will almost certainly be in your macros folder and it will be called from your Gcode job or MDI. If as part of that macro the signal is set
then the signalscript will catch it and take the action defined for that signal in the signal library.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: How can I edit lua script?
« Reply #8 on: February 06, 2018, 05:27:21 AM »
Thank you DAZ and Craig,

I could finally find where the script is.

I could hardly think that the Title of the Screen... "WX4" would include the script....



Thank you~ ;)