need some help on this lua script for my ct for killer7

Add topics here with methods, analysis, code snippets, mods etc. for a certain game that normally won't make it in the Tables or Requests sections.
User avatar
dreamcactus
Expert Cheater
Expert Cheater
Posts: 144
Joined: Sat Jul 06, 2019 12:21 pm
Reputation: 0

need some help on this lua script for my ct for killer7

Post by dreamcactus »

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 = "Killer7Win.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)

PROCESS_NAME = 'Killer7Win.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("Mask Powerup").active=true
        getAddressList().getMemoryRecordByDescription("Dan Powerup").active=true
        getAddressList().getMemoryRecordByDescription("Garcian Powerup").active=true
	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
problem is i get this error when i launch my game from the cheat table

> Error:[string "controlMainForm = getMainForm()
..."]:52: attempt to index a nil value

please help me out guys
Attachments
Killer7 Powerups.CT
(3.66 KiB) Downloaded 85 times

User avatar
dreamcactus
Expert Cheater
Expert Cheater
Posts: 144
Joined: Sat Jul 06, 2019 12:21 pm
Reputation: 0

Re: need some help on this lua script for my ct for killer7

Post by dreamcactus »

its effectively for auto enabling all cheats
oh and before i forget maybe if also possible have the required values preentered in the ct , they are saved in it , ive saved them , but on launch and game launch its back to 0 , even thou you can see last setting when you open up the ct with a text editor like sublime text

User avatar
dreamcactus
Expert Cheater
Expert Cheater
Posts: 144
Joined: Sat Jul 06, 2019 12:21 pm
Reputation: 0

Re: need some help on this lua script for my ct for killer7

Post by dreamcactus »

well a real helpful fucking community you guys are over here , heres a CT that works and autoenables now, but still is missing the save function for entered values, so if anyone with the skillz could help out it would be appreciated
Attachments
Killer7 Powerups + Char TV.CT
(4.63 KiB) Downloaded 85 times

TimFun13
Expert Cheater
Expert Cheater
Posts: 1354
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 6

Re: need some help on this lua script for my ct for killer7

Post by TimFun13 »

dreamcactus wrote:
Sat Feb 15, 2020 5:07 pm
well a real helpful fucking community you guys are over here , heres a CT that works and autoenables now, but still is missing the save function for entered values, so if anyone with the skillz could help out it would be appreciated
Not even one is here every day, have some patience. And the more advanced the question the more time you need to wait for the right person to see it.

As far as saving goes, how are you doing it now. CE does save the last value, but it doesn't load it. You could parse the XML file and use that, or write some Lua to save the values and reload them.

Here is a Lua module I use to save and load which scripts are active, and I set the defaults in the scripts them selves. But you could add some code to save/load values as well.

Code: Select all

local NAME = 'I2 Cheat Engine Table State'
local CLASS_NAME = 'I2CETState'
local VERSION = '1.0.3'
local AUTHOR = 'Matt Irwin'
local LICENSE = [=[MIT License

Copyright (c) 2017 Matt Irwin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sub-license, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
]=]

local format = string.format
local strE = string.empty or STRING_EMPTY or ''
local t = translate

if MainForm == nil then
	MainForm = getMainForm()
end
if AddressList == nil then
	AddressList = getAddressList()
end



I2CETState = {
	Name = NAME, 
	ClassName = CLASS_NAME, 
	Version = VERSION, 
	Author = AUTHOR, 
	License = LICENSE, 
	DefaultState = 'default', 
	SaveFileName = 'I2CETState.${StateName}.txt', 
	UseMemoryRecordDescriptions = false, 
	LineEnd = '\n', 
	DisableBeforeLoad = true, 
	PrintStatus = false, --true, 
}



-- local Logger = {
-- 	LEVELS = {
-- 		OFF = 0, 
-- 		FATAL = 1, 
-- 		ERROR = 2, 
-- 		WARN = 3, 
-- 		INFO = 4, 
-- 		DEBUG = 5, 
-- 		TRACE = 6
-- 	}, 
-- }
-- for k, v in pairs(Logger.LEVELS) do
-- 	-- Logger[k:lower()] = function( ... ) return end
-- 	-- Logger[k:lower() .. 'f'] = function( ... ) return end
-- 	Logger[k:lower()] = function(msg, ex) return print(msg, ex) end
-- 	Logger[k:lower() .. 'f'] = function(msg, ... ) return print(string.format(msg, ... )) end
-- end
local Logger = Logger
if Logger == nil then
	if type(CETrequire) == 'function' then
		Logger = CETrequire('I2CETLogger')
	else
		Logger = require('I2CETLogger')
	end
	Logger.LogName = 'CETstate'
end


if type(CETrequire) == 'function' then
	I2CEHelpers = CETrequire('I2CEHelpers')
else
	I2CEHelpers = require('I2CEHelpers')
end


local function split(s, delimiter)
	return I2CEHelpers.split(s, delimiter)
end

local function interp(s, tbl)
	return I2CEHelpers.interp(s, tbl)
end



function I2CETState.saveTableState(stateName)
	Logger.trace()
	if not inMainThread() then
		return I2CETState.saveTableStateT(stateName)
	end
	local le = I2CETState.LineEnd
	if stateName == nil then
		stateName = I2CETState.DefaultState
	end
	local fileName = interp(I2CETState.SaveFileName, { StateName = stateName } )
	local fileStr = strE
	for i = 0, AddressList.Count - 1 do
		local mr = AddressList.getMemoryRecord(i)
		if mr.Description ~= '_[  I2CETState  ]_' 
		and mr.Description ~= '_[  Save Table State  ]_' 
		and mr.Description ~= '_[  Load Table State  ]_' 
		and mr.Description:sub(0, 16) ~= 'Load Table State'
		and mr.Description:sub(0, 16) ~= 'Save Table State' then
			if mr.Active then
				local id = tostring(mr.ID)
				if I2CETState.UseMemoryRecordDescriptions then
					id = mr.Description
				end
				fileStr = fileStr .. id .. le
			end
		end
	end
	local f, err = io.open(fileName, 'w')
	if err then
		Logger.errorf('The file could not be opened, "%s", %s', fileName, err)
	elseif f and not err then
		f:write(fileStr)
		f:close()
	end
end

local function saveTableStateThread_logError(thread, fileName, err)
	Logger.errorf('The file could not be opened, "%s", %s', fileName, err)
	checkSynchronize()
	thread.terminate()
end

local function saveTableStateThread(thread, stateName)
	local le = I2CETState.LineEnd
	if stateName == nil then
		stateName = I2CETState.DefaultState
	end
	local fileName = interp(I2CETState.SaveFileName, { StateName = stateName } )
	local fileStr = strE
	for i = 0, AddressList.Count - 1 do
		local mr = AddressList.getMemoryRecord(i)
		if mr.Description ~= '_[  I2CETState  ]_' 
		and mr.Description ~= '_[  Save Table State  ]_' 
		and mr.Description ~= '_[  Load Table State  ]_' 
		and mr.Description:sub(0, 16) ~= 'Load Table State'
		and mr.Description:sub(0, 16) ~= 'Save Table State' then
			if mr.Active then
				local id = tostring(mr.ID)
				if I2CETState.UseMemoryRecordDescriptions then
					id = mr.Description
				end
				fileStr = fileStr .. id .. le
			end
		end
	end
	local f, err = io.open(fileName, 'w')
	if err then
		synchronize(saveTableStateThread_logError, fileName, err)
	elseif f and not err then
		f:write(fileStr)
		f:close()
	end
	thread.terminate()
end

function I2CETState.saveTableStateT(stateName)
	Logger.trace()
	createThread(saveTableStateThread, stateName)
end



function I2CETState.loadTableState(stateName)
	Logger.trace()
	if not inMainThread() then
		return I2CETState.loadTableStateT(stateName)
	end
	if I2CETState.PrintStatus and Logger.Level <= Logger.LEVELS.WARN then
		getLuaEngine().show()
	end
	local le = I2CETState.LineEnd
	if stateName == nil then
		stateName = I2CETState.DefaultState
	end
	if I2CETState.PrintStatus and Logger.Level <= Logger.LEVELS.WARN then
		print(format('Setting Table State:  %s', stateName))
	end
	local fileName = interp(I2CETState.SaveFileName, { StateName = stateName } )
	Logger.debugf('Using state file name: "%s"', fileName)
	local fileStr = nil
	local f, err = io.open(fileName, 'r')
	if err then
		Logger.infof('The local file could not be opened, "%s", %s', fileName, err)
		local tableFile = findTableFile(fileName)
		if tableFile == nil then
			Logger.warnf('file not found, "%s"', fileName)
			return
		end
		local stream = tableFile.getData()
		local bytes = stream.read(stream.Size)
		for i = 1, #bytes do
			if fileStr == nil then
				fileStr = strE
			end
			fileStr = fileStr .. string.char(bytes[i])
		end
	elseif f and not err then
		fileStr = f:read('*all')
		f:close()
	else
		Logger.errorf('The file could not be opened, "%s"', fileName)
	end
	if I2CETState.DisableBeforeLoad then
		for i = AddressList.Count - 1, 0, -1 do
			local mr = AddressList.getMemoryRecord(i)
			if mr.Description ~= '_[  I2CETState  ]_' 
		and mr.Description ~= '_[  Save Table State  ]_' 
		and mr.Description ~= '_[  Load Table State  ]_' 
			and mr.Description:sub(0, 16) ~= 'Load Table State'
			and mr.Description:sub(0, 16) ~= 'Save Table State' then
				if mr.Active then
					Logger.infof('Disabling memory record: %d, %d, "%s"', mr.Index, mr.ID, mr.Description)
					if I2CETState.PrintStatus and Logger.Level <= Logger.LEVELS.WARN then
						print(format('Disabling:  %s', mr.Description))
					end
					mr.Active = false
					while mr.Async and mr.AsyncProcessing do
						checkSynchronize()
					end
					sleep(0)
				end
			end
		end
		sleep(0)
	end
	if fileStr == nil then
		Logger.info('File string was nil')
		return
	end
	local lines = split(fileStr, I2CETState.LineEnd)
	for i, v in ipairs(lines) do
		if v ~= nil and v ~= strE then
			local mr = nil
			if I2CETState.UseMemoryRecordDescriptions then
				mr = AddressList.getMemoryRecordByDescription(v)
			else
				mr = AddressList.getMemoryRecordByID(tonumber(v))
			end
			if mr ~= nil then
				if not mr.Active then
					Logger.infof('Enabling memory record: %d, %d, "%s"', mr.Index, mr.ID, mr.Description)
					if I2CETState.PrintStatus and Logger.Level <= Logger.LEVELS.WARN then
						print(format('Enabling:  %s', mr.Description))
					end
					mr.Active = true
					while mr.Async and mr.AsyncProcessing do
						checkSynchronize()
					end
					sleep(0)
				end
			end
		end
	end
	if I2CETState.PrintStatus and Logger.Level <= Logger.LEVELS.WARN then
		print(format('Table State Set:  %s', stateName))
		getLuaEngine().hide()
	end
end


local function loadTableStateThreadSynced(thread, stateName)
	Logger.trace()
	if I2CETState.PrintStatus and Logger.Level <= Logger.LEVELS.WARN then
		getLuaEngine().show()
	end
	local le = I2CETState.LineEnd
	if stateName == nil then
		stateName = I2CETState.CurrentStateName or I2CETState.DefaultState
	end
	if I2CETState.PrintStatus and Logger.Level <= Logger.LEVELS.WARN then
		print(format('Setting Table State:  %s', stateName))
	end
	local fileName = interp(I2CETState.SaveFileName, { StateName = stateName } )
	Logger.debugf('Using state file name: "%s"', fileName)
	local fileStr = nil
	local f, err = io.open(fileName, 'r')
	if err then
		Logger.infof('The local file could not be opened, "%s", %s', fileName, err)
		local tableFile = findTableFile(fileName)
		if tableFile == nil then
			Logger.warnf('file not found, "%s"', fileName)
			return
		end
		local stream = tableFile.getData()
		local bytes = stream.read(stream.Size)
		for i = 1, #bytes do
			if fileStr == nil then
				fileStr = strE
			end
			fileStr = fileStr .. string.char(bytes[i])
		end
	elseif f and not err then
		fileStr = f:read('*all')
		f:close()
	else
		Logger.errorf('The file could not be opened, "%s"', fileName)
	end
	if I2CETState.DisableBeforeLoad then
		for i = AddressList.Count - 1, 0, -1 do
			local mr = AddressList.getMemoryRecord(i)
			if mr.Description ~= '_[  I2CETState  ]_' 
		and mr.Description ~= '_[  Save Table State  ]_' 
		and mr.Description ~= '_[  Load Table State  ]_' 
			and mr.Description:sub(0, 16) ~= 'Load Table State'
			and mr.Description:sub(0, 16) ~= 'Save Table State' then
				if mr.Active then
					Logger.infof('Disabling memory record: %d, %d, "%s"', mr.Index, mr.ID, mr.Description)
					if I2CETState.PrintStatus and Logger.Level <= Logger.LEVELS.WARN then
						print(format('Disabling:  %s', mr.Description))
					end
					mr.Active = false
					AddressList.setSelectedRecord(mr)
					while mr.Async and mr.AsyncProcessing do
						checkSynchronize()
						MainForm.repaint()
						sleep(0)
					end
					sleep(0)
				end
			end
		end
		sleep(0)
	end
	if fileStr == nil then
		Logger.info('File string was nil')
		return
	end
	local lines = split(fileStr, I2CETState.LineEnd)
	for i, v in ipairs(lines) do
		if v ~= nil and v ~= strE then
			local mr = nil
			if I2CETState.UseMemoryRecordDescriptions then
				mr = AddressList.getMemoryRecordByDescription(v)
			else
				mr = AddressList.getMemoryRecordByID(tonumber(v))
			end
			if mr ~= nil then
				if not mr.Active then
					Logger.infof('Enabling memory record: %d, %d, "%s"', mr.Index, mr.ID, mr.Description)
					if I2CETState.PrintStatus and Logger.Level <= Logger.LEVELS.WARN then
						print(format('Enabling:  %s', mr.Description))
					end
					mr.Active = true
					AddressList.setSelectedRecord(mr)
					while mr.Async and mr.AsyncProcessing do
						checkSynchronize()
						MainForm.repaint()
						sleep(0)
					end
					sleep(0)
				end
			end
		end
	end
	if I2CETState.PrintStatus and Logger.Level <= Logger.LEVELS.WARN then
		print(format('Table State Set:  %s', stateName))
		getLuaEngine().hide()
	end
	I2CETState.CurrentStateName = nil
	checkSynchronize()
	if thread ~= nil and type(thread.terminate) == 'function' then
		thread.terminate()
	end
end

local function loadTableStateThread(thread, stateName)
	synchronize(loadTableStateThreadSynced, stateName)
	thread.terminate()
end

function I2CETState.loadTableStateT(stateName)
	Logger.trace()
	I2CETState.CurrentStateName = stateName
	createThread(loadTableStateThread, stateName)
end


function I2CETState.setAllScriptsToAsync()
	Logger.trace()
	for i = 0, AddressList.Count - 1 do
		local mr = AddressList.getMemoryRecord(i)
		if mr.Type == vtAutoAssembler and not mr.Async then
			Logger.infof('Set memory record async: %d, %d, "%s"', mr.Index, mr.ID, mr.Description)
			mr.Async = true
		end
	end
end


function I2CETState.setAllScriptsToNoAsync()
	Logger.trace()
	for i = 0, AddressList.Count - 1 do
		local mr = AddressList.getMemoryRecord(i)
		if mr.Type == vtAutoAssembler and mr.Async then
			Logger.infof('Set memory record no async: %d, %d, "%s"', mr.Index, mr.ID, mr.Description)
			mr.Async = false
		end
	end
end


return I2CETState

User avatar
dreamcactus
Expert Cheater
Expert Cheater
Posts: 144
Joined: Sat Jul 06, 2019 12:21 pm
Reputation: 0

Re: need some help on this lua script for my ct for killer7

Post by dreamcactus »

ok , no offense but i dont get that lua script of yours at all ,ill post you my updated lua script, now what do i have to add to it for it to save and load current set values, thats what i need , and great to see this community isnt dead afterall

updated lua script>

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 = "Killer7Win.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)

PROCESS_NAME = 'Killer7Win.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("Mask Powerup (00 is default, 01 is Encounter 1, 02 is Alter Ego, 03 is Smile 2)").active=true
getAddressList().getMemoryRecordByDescription("Dan Powerup (00 is default, 01 is Demon Gun)").active=true
getAddressList().getMemoryRecordByDescription("Garcian Powerup (00 is default, 01 is Golden Gun)").active=true
getAddressList().getMemoryRecordByDescription("HS kill requirements (set it to 00 00 0F FF unlock everyone withou Kill)").active=true
getAddressList().getMemoryRecordByDescription("Char TV (set it to 00 00 FF FF to unlock everyone)").active=true
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
Attachments
Killer7 Powerups + Char TV.CT
(4.63 KiB) Downloaded 81 times

TimFun13
Expert Cheater
Expert Cheater
Posts: 1354
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 6

Re: need some help on this lua script for my ct for killer7

Post by TimFun13 »

dreamcactus wrote:
Sun Feb 16, 2020 12:41 pm
...
Something like this should work.

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 = "Killer7Win.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 = {
	"Mask Powerup (00 is default, 01 is Encounter 1, 02 is Alter Ego, 03 is Smile 2)", 
	"Dan Powerup (00 is default, 01 is Demon Gun)", 
	"Garcian Powerup (00 is default, 01 is Golden Gun)", 
	"HS kill requirements (set it to 00 00 0F FF unlock everyone withou Kill)", 
	"Char TV (set it to 00 00 FF FF to unlock everyone)", 
}

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 = 'Killer7Win.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("Mask Powerup (00 is default, 01 is Encounter 1, 02 is Alter Ego, 03 is Smile 2)").active=true
		-- getAddressList().getMemoryRecordByDescription("Dan Powerup (00 is default, 01 is Demon Gun)").active=true
		-- getAddressList().getMemoryRecordByDescription("Garcian Powerup (00 is default, 01 is Golden Gun)").active=true
		-- getAddressList().getMemoryRecordByDescription("HS kill requirements (set it to 00 00 0F FF unlock everyone withou Kill)").active=true
		-- getAddressList().getMemoryRecordByDescription("Char TV (set it to 00 00 FF FF to unlock everyone)").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

User avatar
dreamcactus
Expert Cheater
Expert Cheater
Posts: 144
Joined: Sat Jul 06, 2019 12:21 pm
Reputation: 0

Re: need some help on this lua script for my ct for killer7

Post by dreamcactus »

HOLY SHIT!!! it fucking worked! not gay , but i LOVE YOU !!! Saves Settings like a champ now

from what ive seen in the script , this i can use for non Value Cheat Tables as well as Cheat Tables with Values in other games right? and ist it able to save settings that are like tables in tables aka subdirs, like this > guard break cheat > how much breaking set

TimFun13
Expert Cheater
Expert Cheater
Posts: 1354
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 6

Re: need some help on this lua script for my ct for killer7

Post by TimFun13 »

dreamcactus wrote:
Tue Feb 18, 2020 2:42 pm
HOLY SHIT!!! it fucking worked! not gay , but i LOVE YOU !!! Saves Settings like a champ now

from what ive seen in the script , this i can use for non Value Cheat Tables as well as Cheat Tables with Values in other games right? and ist it able to save settings that are like tables in tables aka subdirs, like this > guard break cheat > how much breaking set
You can use it with any cheat table, you'll just have to update the "NameList" for each table. And it does use a relative file name, so if you open CE then open a table, it won't really work; but if you open a CT file in any directory then it will work and save in that directory, if you want to make it always work you can also change the "FileName" for each table and give it a full path (i.e: [[L:\Documents\My Cheat Tables\Far Cry 3\FarCry3Settings.txt]]). But if you share your tables then I would stick with the relative path (just a file name with no path), and just post the table with instructions explaining they need to open the CT file in a separate directory.

User avatar
dreamcactus
Expert Cheater
Expert Cheater
Posts: 144
Joined: Sat Jul 06, 2019 12:21 pm
Reputation: 0

Re: need some help on this lua script for my ct for killer7

Post by dreamcactus »

not what ive meant bro , but thanks for explaining that , what ive meant more like if you checkout this table here for dmc5>
Attachments
SSSiyanCollabTU5_1.1.CT
(386.55 KiB) Downloaded 79 times
Last edited by dreamcactus on Wed Feb 19, 2020 7:08 am, edited 2 times in total.

User avatar
dreamcactus
Expert Cheater
Expert Cheater
Posts: 144
Joined: Sat Jul 06, 2019 12:21 pm
Reputation: 0

Re: need some help on this lua script for my ct for killer7

Post by dreamcactus »

you can see it has no values just enable or disable aka script based , now it has subtables in some of the tables that do have values, what i need to know is what would i have to change in the namelist to have it save those even thou theyre deeper in a subdir, for example the > Enemy Step Inertia,

maybe a change to the script that saves said script tables including entire subdirs changes, ive been thinking like if there would be an even easier way for the saving as well , so one doesnt have to enter the entire CTs table and subtable naming into the namelist, theres CTs with thousands of Table Names mind you, same would go for the autoenabling part ive posted into the bottom of that lua as youve seen, maybe some command that simply saves changes of the entire CT and autoenables those on a fresh launch , globally , yes i know figuring this out isnt easy at all

User avatar
dreamcactus
Expert Cheater
Expert Cheater
Posts: 144
Joined: Sat Jul 06, 2019 12:21 pm
Reputation: 0

Re: need some help on this lua script for my ct for killer7

Post by dreamcactus »

so where do i add this into my lua script ive posted above in order for it to autosave settings and autoenable them on fresh start , im abit confused as you can tell , sorry bout that

User avatar
dreamcactus
Expert Cheater
Expert Cheater
Posts: 144
Joined: Sat Jul 06, 2019 12:21 pm
Reputation: 0

Re: need some help on this lua script for my ct for killer7

Post by dreamcactus »

btw for anyone thats hacking killer7 , ive got a job for you guys that our community is currently struggling with, this issue>

garcian is forced in the gym which needs the 00 value
so the game will crash inevitably with value 01
and you need to use mask to get access to the freaky fun house which needs the 01 value, wont work with value 03

so both cheats, need a fix >

"Mask Powerup (00 is default, 01 is Encounter 1, 02 is Alter Ego, 03 is Smile 2)", Set to 03

and

"Garcian Powerup (00 is default, 01 is Golden Gun)", Set to 01


we all would be grateful for the help

User avatar
dreamcactus
Expert Cheater
Expert Cheater
Posts: 144
Joined: Sat Jul 06, 2019 12:21 pm
Reputation: 0

Re: need some help on this lua script for my ct for killer7

Post by dreamcactus »

so has anyone figured out a fix for the current issue with both of those ?

User avatar
dreamcactus
Expert Cheater
Expert Cheater
Posts: 144
Joined: Sat Jul 06, 2019 12:21 pm
Reputation: 0

Re: need some help on this lua script for my ct for killer7

Post by dreamcactus »

well...anybody ? would be killer

User avatar
dreamcactus
Expert Cheater
Expert Cheater
Posts: 144
Joined: Sat Jul 06, 2019 12:21 pm
Reputation: 0

need some help on this lua script for my ct for killer7

Post by dreamcactus »

bump for the sake of this not being forgotten

Post Reply

Who is online

Users browsing this forum: No registered users