Page 1 of 1

Not allow user to lock value (not allow to mark items as 'X')

Posted: Wed Aug 17, 2022 2:43 am
by bbfox

This script will force table item(s) cannot be "locked". i.e. you don't want user to lock a value.
Image

Original discussion from OCT.org:

Code: Select all

--memory record IDs now allowed to be 'locked'
-- IDs: list of ID found in .CT file:
-- <CheatEntry>
--      <ID>2218</ID>  <--- Here

-- Memory record IDs now allowed to be 'locked'
IDs = {999999, 9999999}

-- Determine event trigger sequence
if not contains then
    function contains(table, val)
       for i = 1, #table do
          if table[i] == val then
             return true
          end
       end
       return false
    end
end

if not onMemRecPreExecute then
    function onMemRecPreExecute(memoryrecord, newstate)
        if contains(IDs, memoryrecord.ID) and newstate then
            synchronize(function()
                if not memoryrecord.OnActivate then
                    memoryrecord.OnActivate = function(memoryrecord, before, currentstate)
                        return false
                    end
                end
            end)
        end
    end
end