Need Help on my Lua Script to force a certain Value permanently constantly
Posted: Thu May 13, 2021 6:16 pm
so in this Lua Script i got , well it dont force a certain Value and make sure its constantly forced for listed Cheat thats set to autoenable on start, named>
"max jump everywhere - change value to 60",
"max jump everywhere - change value to 60",
Code: Select all
controlMainForm = getMainForm()
AddressList = getAddressList()
if getCEVersion == nil or getCEVersion() < 6.5 then
messageDialog('It is recommended to use at least Cheat Engine 6.7! (Your Version: '..getCEVersion()..')', mtError, mbOK)
end
errorOnLookupFailure(false)
setGlobalDelayBetweenHotkeyActivation(200)
DefaultProccessName = "pcsx2.exe"
strings_add(getAutoAttachList(), DefaultProccessName)
PRIVATETABLE, SWITCHSUPPORT = true, false
function cycleFullCompact(sender,force)
local state = not(compactmenuitem.Caption == 'Compact View Mode')
if force~=nil then state = not force end
compactmenuitem.Caption = state and 'Compact View Mode' or 'Full View Mode'
getMainForm().Splitter1.Visible = state
getMainForm().Panel4.Visible = state
getMainForm().Panel5.Visible = state
end
function addCompactMenu()
if compactmenualreadyexists then return end
local parent = getMainForm().Menu.Items
compactmenuitem = createMenuItem(parent); parent.add(compactmenuitem)
compactmenuitem.Caption = 'Compact View Mode'
compactmenuitem.OnClick = cycleFullCompact
compactmenualreadyexists = 'yes'
end
addCompactMenu()
cycleFullCompact(nil, true)
----
local format = string.format
local strE = ''
function split(s, delimiter)
result = {}
for match in (s .. delimiter):gmatch('(.-)' .. delimiter) do
table.insert(result, match)
end
return result
end
local le = '\r\n'
FileName = "MemoryRecordValues.txt"
NameList = {
"max jump everywhere - change value to 60",
}
function saveValues()
local fileStr = strE
if stateName == nil then
stateName = I2CETState.DefaultState
end
for i = 1, #NameList do
local mr = AddressList.getMemoryRecordByDescription(NameList[i])
if mr ~= nil then
local value = mr.Value
fileStr = fileStr .. value .. le
else
error(format('The memory record was not found, "%s"', NameList[i]))
end
end
local f, err = io.open(FileName, 'w')
if err then
error(format('The file could not be opened, "%s", %s', FileName, err))
elseif f and not err then
f:write(fileStr)
f:close()
end
end
function loadValues()
Logger.debugf('Using state file name: "%s"', FileName)
local fileStr = nil
local f, err = io.open(FileName, 'r')
if err then
error(format('The file could not be opened, "%s", %s', FileName, err))
elseif f and not err then
fileStr = f:read('*all')
f:close()
else
error(format('The file could not be opened, "%s"', FileName))
end
if fileStr == nil then
error(format('File string was nil'))
return
end
local lines = split(fileStr, le)
for i, v in ipairs(lines) do
if v ~= nil and v ~= strE then
local mr = AddressList.getMemoryRecordByDescription(NameList[i])
if mr ~= nil then
mr.Value = v
else
error(format('The memory record was not found, "%s"', NameList[i]))
end
end
end
end
----
PROCESS_NAME = 'pcsx2.exe'
--------
-------- Auto Attach
--------
local autoAttachTimer = nil ---- variable to hold timer object
local autoAttachTimerInterval = 100 ---- Timer intervals are in milliseconds
local autoAttachTimerTicks = 0 ---- variable to count number of times the timer has run
local autoAttachTimerTickMax = 5000 ---- Set to zero to disable ticks max
local function autoAttachTimer_tick(timer) ---- Timer tick call back
---- Destroy timer if max ticks is reached
if autoAttachTimerTickMax > 0 and autoAttachTimerTicks >= autoAttachTimerTickMax then
timer.destroy()
end
---- Check if process is running
if getProcessIDFromProcessName(PROCESS_NAME) ~= nil then
timer.destroy() ---- Destroy timer
openProcess(PROCESS_NAME) ---- Open the process
-- getAddressList().getMemoryRecordByDescription("max jump everywhere - change value to 60)").active=true
--
---- Just a way to do this with the NameList,
---- thus you can just add to the list to make it work with other memory records.
for i = 1, #NameList do
local mr = AddressList.getMemoryRecordByDescription(NameList[i])
if mr ~= nil then
mr.Active = true
else
error(format('The memory record was not found, "%s"', NameList[i]))
end
end
end
autoAttachTimerTicks = autoAttachTimerTicks + 1 ---- Increase ticks
end
autoAttachTimer = createTimer(getMainForm()) ---- Create timer with the main form as it's parent
autoAttachTimer.Interval = autoAttachTimerInterval ---- Set timer interval
autoAttachTimer.OnTimer = autoAttachTimer_tick ---- Set timer tick call back