Hello Guest it is September 23, 2023, 11:02:46 AM

Author Topic: Script editor strange behavior - or is it me?  (Read 1797 times)

0 Members and 1 Guest are viewing this topic.

Script editor strange behavior - or is it me?
« on: February 28, 2020, 02:25:19 PM »
I'm trying to edit my ScreenScript.lua - the below function appears to be missing the declaration for inst and I get a nil error every time the function is called

No problem, I insert the missing line. The editor won't let me save the file, access is denied. So I do a "save as", exit and rename the file.

I check it to make sure my changes are there.

Then I open Mach and to my surprise if I view the screen script the change is not there. If I exit Mach and edit the file again sure enough it is gone.

I must be missing something

function GetFixOffsetVars() 
        local FixOffset = mc.mcCntlGetPoundVar(inst, 4014)
        FixOffset = FixOffset * 10
        local PoundVarX = 5221
        if (FixOffset < 7) then
            PoundVarX = 5221 + ((FixOffset - 1) * 20)
        else
            PoundVarX = 7001 + ((FixOffset - 7) * 20)
        end
        PoundVarY = PoundVarX + 1
        PoundVarZ = PoundVarX + 2
        return PoundVarX, PoundVarY, PoundVarZ
    end
Re: Script editor strange behavior - or is it me?
« Reply #1 on: February 28, 2020, 11:37:29 PM »
Hi,
this post belongs on the Mach4 General Discussion Board and no doubt tweakie will shift it there.

Quote
I'm trying to edit my ScreenScript.lua

ScreenScrpit.lua IS NOT EDITABLE.

It is in fact ALL the Lua code fragments/marcos put together into one large file, it is not nor was ever intended to be
editable.  If you wish to edit it you must edit that Lua fragment and that edited fragment will get included in the new ScreenScript.lua.

Craig

'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Script editor strange behavior - or is it me?
« Reply #2 on: March 02, 2020, 10:15:35 AM »
I get it, thanks!!
Re: Script editor strange behavior - or is it me?
« Reply #3 on: March 02, 2020, 11:50:24 AM »
i think you missing the "inst" parameter define
its function and even you define it before on the main ,you need define inside the function
(about 6- month they upgrade the version then its become like that)

Re: Script editor strange behavior - or is it me?
« Reply #4 on: March 02, 2020, 03:56:29 PM »
Thanks, yes that is exactly what I thought the problem is
Re: Script editor strange behavior - or is it me?
« Reply #5 on: May 17, 2021, 04:03:11 PM »
Hi, where can i edit a specific LUA fragment of the screen script? I typed in a syntax error and mach4 just closes after starting. I know exactly which is the syntax error. I hope you can answer rapidly so i can go on with the development of my screen and my profile. Thanks.
Re: Script editor strange behavior - or is it me?
« Reply #6 on: May 18, 2021, 10:33:54 AM »
Operator->edit screen.  Click the profile in the Screen Tree Manager.  Click the Events icon in the properties tab.  Click the ellipses on the screen load script.  locate the offending code, edit and save.

If you haven't watched the screen editing video it is worth a view:

https://www.youtube.com/watch?v=P1xZkFgS5cQ

HTH

RT
Re: Script editor strange behavior - or is it me?
« Reply #7 on: May 19, 2021, 10:13:55 AM »
Hi.

The situation was i couldnĀ“t enter the screen editor because the GUI would close almost as soon as i picked the profile i wanted to work with, at start. Luckily one guy on a Facebook forum helped me as he proposed an excellent solution: add a couple of commands to the route of the file in the properties of the Mach4 loader desktop shortcut, so the software could go right to the screen editor at start up, and i could correct the syntax errors to have the screen script running in the right way.

Offline Bill_O

*
  •  533 533
    • View Profile
Re: Script editor strange behavior - or is it me?
« Reply #8 on: May 19, 2021, 11:33:21 AM »
Daniel,

Just out of curiosity what did you need to do to the shortcut to open screen editor on startup?

Bill
Re: Script editor strange behavior - or is it me?
« Reply #9 on: May 19, 2021, 11:49:54 AM »
C:\Mach4Hobby\Mach4GUI.exe /pnameofprofile /e