Hi,
OK, that function GoToWorkZero() is correct, the two lines which follow it and are commented out are just so you can see what is included in the function,
they were never intended to be uncommented.
The actual function is in the screenload script and has those two lines included, you comment out the one you don't want and leave the other.
What you have in fact done is to have two definitions of that function.
This is whats it my screenload script at the moment:
---------------------------------------------------------------
-- Go To Work Zero() function.
---------------------------------------------------------------
function GoToWorkZero()
mc.mcCntlMdiExecute(inst, "G00 X0 Y0 A0")--Without Z moves
--mc.mcCntlMdiExecute(inst, "G00 G53 Z0\nG00 X0 Y0 A0\nG00 Z0")--With Z moves
end
I have a couple of other custom scripts so I guess you would find this code around line 220 in the screenload script. This is the code you should edit/replace or whatever.
You'll have to go back and apply comment marks to those lines you uncommented earlier.
A couple of points that may help or certainly save you some grief in times to come.
Its great that you are starting to modify screensets and things, it very Much part of Mach4 that you customize it to suit your machine. Like you I use wx4.set.
There is a problem with that though....if I go and make new buttons and controls, screen scripts and so on they get saved to wx4.set. That means I'm screwing
up my 'clean' copy but even that's not a big problem. What happens when I download the latest and greatest Mach4 build from NFS? The screenset wx4.set will
get overwritten with the latest and greatest wx4.set too. That means all my tweaks and scripts have been wiped....bugger!
The trick is to make a copy of wx4.set but call it something personal like Craigswx4.set and use that screenset in your profile and all your tweaks get saved to it and
won't be overwritten when you update Mach.
Next point is that there are quite a number of chunks of Lua code, the sreenload script you've encountered but there are others like the PLC script, the PMC script
and so on. When Mach runs ALL these scripts get rounded up and compiled into one big file called the Lua script. If you go to the operator menu there is an option
to view it. Interesting and you can use search functions to find specific bits of code but you CAN'T edit it, its just for looks!
Another point worth mentioning is that when you start writing your own scripts you will be putting some bits in the screenload script and other bits elsewhere.
If you make a mistake it can be awfully hard to track down where it is. What I do and recommend to you is that you make a folder in your profile and write all
your code in it. You'll be able to use the editor and debugger, and if you really screw it up you only have one bad file to dig out to get Mach running again.
Once your happy that the code will work without crashing Mach that's when you place it in the screenload script or wherever.
Craig