Page 1 of 1
Enabling scripts in the Cheat Table automatically
Posted: Mon Jan 09, 2023 1:03 pm
by Vinnie_Irish
Hi guys,
I need some help/advice please with getting a game running with CT scripts in cheat engine, to turn off certain effects.
I’ve managed to get hold of a CT file which does exactly this and has been successfully tested with the game manually.
I'd like to have this process automated via a batch file though. So far, I've managed to script the batch file so that it's starts up Need for Speed, then opens the CT file using Cheat engine. “Needforspeedunbound.exe” is automatically selected as the process. The scripts for the CT then appear in the table at bottom.
I’m struggling to get these scripts enabled automatically though.
Can someone please point me in the right direction? It would be much appreciated. I’m clueless with LUA scripts, which I’ve seen recommended as the solution in these cases. Even if it's one line, something to lead with and I'll do the rest. Thanks in advance.
My batch file looks like this:
echo off
start /b "" "E:\Program Files\EA Games\Need for Speed Unbound\NeedForSpeedUnbound.exe"
start /min "" "F:\Documents\My Cheat Tables\NeedForSpeedUnbound.ct"
exit
The CT in Cheat engine looks like this, I've marked the scripts that need enabling with red X's:
Actual Cheat Trainer file:
download/file.php?id=47735
Re: Enabling scripts in the Cheat Table automatically
Posted: Mon Jan 09, 2023 6:41 pm
by Paul44
^ add following in your Lua startup script ('Table' menu option):
(just add it after 'getAutoAttachList()...' line ~ you can add empty lines for readability)
local mr = al.getMemoryRecordByID(26072)
mr.Active = true
mr = al.getMemoryRecordByID(26080)
mr.Active = true
...etc...
=> save table and load again: it will ask to run scripts... yes ofc...
tip: try first with 1 script !
note: open your CT table with notepad, find the script in question use its '<ID>26072</ID>'
eg: Cartoon Smokes -> id = 122
Re: Enabling scripts in the Cheat Table automatically
Posted: Mon Jan 09, 2023 8:24 pm
by Vinnie_Irish
Thanks for your help Paul, I'll give it a go and let you know how it goes.
Re: Enabling scripts in the Cheat Table automatically
Posted: Tue Jan 10, 2023 6:47 pm
by LeFiXER
Vinnie_Irish wrote: ↑Mon Jan 09, 2023 8:24 pm
Thanks for your help Paul, I'll give it a go and let you know how it goes.
This won't watch for the process and then attach automatically, but here is a script that will attach to the game and then enable all the scripts assigned to the table:
Code: Select all
local scriptsToActivate = {
[1] = 'Cartoon Smokes',
[2] = 'Cartoon Wings While Airborne',
[3] = 'Trail Lights and Air Lines',
[4] = 'Wheel Confetti',
[5] = 'Cleaner Burst Nos Effect',
}
local processList = getProcessList()
local currentProcess = readInteger(process)
local gameName = '.exe' -- Set EXE name here!
local function enableScripts()
for i = 0, AddressList.Count - 1 do
local mr = AddressList.getMemoryRecordByID(i)
for k,v in pairs(scriptsToActivate) do
if mr.Description == v then
mr.Active = true
end
end
end
end
if processList[getProcessIDFromProcessName(gameName)] ~= nil then
if (currentProcess == nil) or (currentProcess ~= readInteger(gameName)) then
openProcess(gameName)
end
enableScripts()
end
Re: Enabling scripts in the Cheat Table automatically
Posted: Tue Jan 10, 2023 7:32 pm
by Vinnie_Irish
Thank you so much for your input, I'll add this to the lua script.
Re: Enabling scripts in the Cheat Table automatically
Posted: Thu Jan 12, 2023 3:21 pm
by Vinnie_Irish
Hi guy,
Thanks for your help so far, but I'm not having much luck with scripting this file. I'm not sure where to include the script you advised I use. Do I include it in the Lua Script: Cheat Table of the CT file?
When I load the
NeedForSpeedUnbound.CT file, the Lua Script: Cheat Table has one line in it
1 getAutoAttachList().add("NeedForSpeedUnbound.exe")
Do I include the script you gave me under the line above?
I feel like a clueless tit
LeFiXER wrote: ↑Tue Jan 10, 2023 6:47 pm
This won't watch for the process and then attach automatically, but here is a script that will attach to the game and then enable all the scripts assigned to the table:
Code: Select all
local scriptsToActivate = {
[1] = 'Cartoon Smokes',
[2] = 'Cartoon Wings While Airborne',
[3] = 'Trail Lights and Air Lines',
[4] = 'Wheel Confetti',
[5] = 'Cleaner Burst Nos Effect',
}
local processList = getProcessList()
local currentProcess = readInteger(process)
local gameName = '.exe' -- Set EXE name here!
local function enableScripts()
for i = 0, AddressList.Count - 1 do
local mr = AddressList.getMemoryRecordByID(i)
for k,v in pairs(scriptsToActivate) do
if mr.Description == v then
mr.Active = true
end
end
end
end
if processList[getProcessIDFromProcessName(gameName)] ~= nil then
if (currentProcess) == nil) or (currentProcess ~= readInteger(gameName)) then
openProcess(gameName)
end
enableScripts()
end
Re: Enabling scripts in the Cheat Table automatically
Posted: Thu Jan 12, 2023 9:24 pm
by LeFiXER
Vinnie_Irish wrote: ↑Thu Jan 12, 2023 3:21 pm
Hi guy,
Thanks for your help so far, but I'm not having much luck with scripting this file. I'm not sure where to include the script you advised I use. Do I include it in the Lua Script: Cheat Table of the CT file?
When I load the
NeedForSpeedUnbound.CT file, the Lua Script: Cheat Table has one line in it
1 getAutoAttachList().add("NeedForSpeedUnbound.exe")
Do I include the script you gave me under the line above?
I feel like a clueless tit
Copy the whole of this section, then in your Cheat Table press Ctrl + V. With the game deactivated, and not automatically attaching. Enable the script that was added. It will attach to the game then enable the scripts set out in the Lua data table "
scriptsToActivate":
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<CheatTable>
<CheatEntries>
<CheatEntry>
<ID>0</ID>
<Description>"Activate & Attach"</Description>
<LastState/>
<VariableType>Auto Assembler Script</VariableType>
<AssemblerScript>[ENABLE]
{$LUA}
if syntaxcheck then return end
local scriptsToActivate = {
[1] = 'Cartoon Smokes',
[2] = 'Cartoon Wings While Airborne',
[3] = 'Trail Lights and Air Lines',
[4] = 'Wheel Confetti',
[5] = 'Cleaner Burst Nos Effect',
}
local processList = getProcessList()
local currentProcess = readInteger(process)
local gameName = '.exe' -- Set EXE name here!
local function enableScripts()
for i = 0, AddressList.Count - 1 do
local mr = AddressList.getMemoryRecordByID(i)
for k,v in pairs(scriptsToActivate) do
if mr.Description == v then
mr.Active = true
end
end
end
end
if processList[getProcessIDFromProcessName(gameName)] ~= nil then
if (currentProcess == nil) or (currentProcess ~= readInteger(gameName)) then
openProcess(gameName)
end
enableScripts()
end
[DISABLE]
</AssemblerScript>
</CheatEntry>
</CheatEntries>
</CheatTable>