Page 1 of 1

lua scripts will not mark item as locked (mark as "X") after execute

Posted: Wed Aug 17, 2022 3:52 am
by bbfox

This script will make lua scripts will not be checked ("mark as X") after script executed. Used for executing a lua script without [DISABLE] section.

Original discussion in OCT.org; I did not remember who answered my question.

  1. Step 1: Place this code piece in Cheat table lua script

    Code: Select all

    -- Lua scripts that table checkbox will not be checked with "NO_ACTIVATE" in comment/script body
    if not onMemRecPostExecute then
        function onMemRecPostExecute(memoryrecord, newState, succeeded)
            if memoryrecord.Type == vtAutoAssembler and memoryrecord.Script:find("NO_ACTIVATE") and newState and succeeded then
                synchronize(function()
                    memoryrecord.disableWithoutExecute()
                end)
            end
        end
    end
  2. Step 2: in lua script, place a comment "NO_ACTIVATE" in script. i.e. below script will print a message and keep item unchecked (unlock)

    Code: Select all

    [ENABLE]
    {$lua}
    --NO_ACTIVATE
    if syntaxcheck then return end
    print('Hello World!')
     
    {$asm}
    [DISABLE]
    
    

Re: lua scripts will not mark item as locked (mark as "X") after execute

Posted: Tue May 02, 2023 4:54 pm
by J1327

..or..alternatively you can use in AA: test al,al

example:

Code: Select all

[ENABLE]
{$lua}
if syntaxcheck then return end
print('Hello World!')
{$asm}
test al,al
[DISABLE]

Re: lua scripts will not mark item as locked (mark as "X") after execute

Posted: Wed May 03, 2023 9:52 am
by imjustmaxie

My method might be unorthodox, but what I typically do is this:

Code: Select all

{$LUA}
if syntaxcheck then return end
--insert code here
[enable]
error()
[disable]