View previous topic :: View next topic |
Author |
Message |
HotPieOnARack How do I cheat?
Reputation: 0
Joined: 15 Feb 2022 Posts: 7
|
Posted: Sat Mar 12, 2022 6:09 am Post subject: Lua Blocks not working when exporting trainer exe (Solved) |
|
|
I created a few auto-assemble scripts (including LUA blocks). The scripts work fine, when they are activated in in Cheat Engine (please see attachment).
When I saved the project as exe, cheat engine warned me about "generating a trainer that does nothing" - And it acutlly does nothing 😅.
I was searching the wiki but I couldn't figure out, how these scripts can be "added" when saving a Cheat-Engine-Trianer.EXE.
What I want is:
- Save project as exe
- Start the exported exe
- The scripts I have created should now work with the game
Thank you very much for your help!
PS: I posted this thread to the Lua Scripting section, since I don't know whether you have to do special stuff to export lua scripts. Please feel free to move this thread if this is not the case @mods
EDIT:
Problem solved:
It's a bug in Cheatengine, but there is a workaround:
If you want to use Lua Codeblocks you have to add the luaclient.dll from the Cheatengine root folder manually.
cheatengine.org/viewtopic.php?t=618886
Description: |
Enabled Auto Assembly CI Scripts |
|
Filesize: |
7.29 KB |
Viewed: |
4538 Time(s) |

|
Last edited by HotPieOnARack on Sat Mar 12, 2022 5:05 pm; edited 1 time in total |
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1520
|
Posted: Sat Mar 12, 2022 6:49 am Post subject: |
|
|
Put this code in your Lua script and save Trainer.
Code: | --When the trainer opens, you'll want to connect it to the game.
--Otherwise, the script will not execute.
local check=false
proc=getProcessIDFromProcessName("yourGame.exe") -- your game.exe
if proc~=nil then
check=true
openProcess(proc)
else
check=false
end
function trainerDoingSomething()
if check==true then
addresslist=getAddressList()
CheatEntry1=addresslist_getMemoryRecordByDescription(addresslist,"SCRIPT - LOG - Item Drop")
CheatEntry1.Active=true
CheatEntry2=addresslist_getMemoryRecordByDescription(addresslist,"SCRIPT - LOG - Room Number Change")
CheatEntry2.Active=true
CheatEntry3=addresslist_getMemoryRecordByDescription(addresslist,"SCRIPT - LOG - Looking At Item")
CheatEntry3.Active=true
showMessage("Trainer has been activated.")
else
showMessage("Error! The game is not open!\nTrainer will shut down!!")
closeCE() return cafree()
end
end
trainerDoingSomething() |
_________________
|
|
Back to top |
|
 |
HotPieOnARack How do I cheat?
Reputation: 0
Joined: 15 Feb 2022 Posts: 7
|
Posted: Sat Mar 12, 2022 7:37 am Post subject: |
|
|
AylinCE wrote: | Put this code in your Lua script and save Trainer.
Code: | --When the trainer opens, you'll want to connect it to the game.
--Otherwise, the script will not execute.
local check=false
proc=getProcessIDFromProcessName("yourGame.exe") -- your game.exe
if proc~=nil then
check=true
openProcess(proc)
else
check=false
end
function trainerDoingSomething()
if check==true then
addresslist=getAddressList()
CheatEntry1=addresslist_getMemoryRecordByDescription(addresslist,"SCRIPT - LOG - Item Drop")
CheatEntry1.Active=true
CheatEntry2=addresslist_getMemoryRecordByDescription(addresslist,"SCRIPT - LOG - Room Number Change")
CheatEntry2.Active=true
CheatEntry3=addresslist_getMemoryRecordByDescription(addresslist,"SCRIPT - LOG - Looking At Item")
CheatEntry3.Active=true
showMessage("Trainer has been activated.")
else
showMessage("Error! The game is not open!\nTrainer will shut down!!")
closeCE() return cafree()
end
end
trainerDoingSomething() |
|
Does this go to "Show Cheat Table Lua Script" ?
Description: |
|
Filesize: |
51.7 KB |
Viewed: |
4518 Time(s) |

|
|
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1520
|
Posted: Sat Mar 12, 2022 8:12 am Post subject: |
|
|
Yes this step is correct.
Write the game process where you marked in the picture and click the "Execute Script" button to test the code.
If all goes well, create Trainer.exe and test it.
_________________
|
|
Back to top |
|
 |
HotPieOnARack How do I cheat?
Reputation: 0
Joined: 15 Feb 2022 Posts: 7
|
Posted: Sat Mar 12, 2022 8:34 am Post subject: |
|
|
AylinCE wrote: | Yes this step is correct.
Write the game process where you marked in the picture and click the "Execute Script" button to test the code.
If all goes well, create Trainer.exe and test it. |
Thank you, I can't send you a pm yet so I have to ask in this thread:
I added the code that connects to the game + activates the scripts in the lua cheat table.
- I open the game
- I start Cheat Engine
- I open the Cheat Engine project (without connecting via "File -> "Open Process")
- I run the cheat table lua script
- Cheatengine is connected to the game. The scripts are being executed! This works like charm
When I create a trainer and execute it, the Dialog will Show "Trainer has been activated.". But the Scripts will not work. Maybe I am missing a config? I attached a screenshot of the setup I have to create a trainer.
Could you please look at it? Maybe you see why its not working...
PS:
My lua scripts require external scripts which I placed in Cheat Engines lua folder. May this be the cause?
Description: |
|
Filesize: |
20.18 KB |
Viewed: |
4505 Time(s) |

|
|
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1520
|
Posted: Sat Mar 12, 2022 9:13 am Post subject: |
|
|
This works in my case.
I left the "print(hack)" instruction to the address list scripts.
But this "exe" table won't do you any good.
Let's give it a "Form" and give the Trainer steps to open, start, close. Otherwise the Trainer will still remain open.
If you wait a bit, I will give you a handsome code that will solve this problem..
EDIT :
In your case, this form might work.
Paste this code into your Lua script, test it, and if it's working properly, register it as a Trainer.
Note: Replace "yourGame.exe" with your game process. (In my case "chrome.exe")
Also watch out for "Target" in Trainer Generator.
In your picture, Target 32 bit is selected. In my case it's 64 bit.
good games..
Code: | if form then form.destroy() form = nil end
form = createForm()
form.Popupmode=0;
form.Position=poDesktopCenter form.Width=240 form.Height=180
form.BorderStyle="bsNone" form.ShowInTaskBar="stAlways"
form.setLayeredAttributes(0x000100, 255, LWA_COLORKEY | LWA_ALPHA )
form.Color=0x000100
local RpTitle = createPanel(form)
RpTitle.Left=0 RpTitle.Top=0 RpTitle.Height=35 RpTitle.Width=240
RpTitle.Font.Size=14 RpTitle.Font.Style='fsBold' RpTitle.Cursor= -22
RpTitle.OnMouseDown = function() form.DragNow() end
RpTitle.BevelWidth=5 RpTitle.Color=4259328
RpTitle.Caption=[[By AylinCE Trainer]]
local RpTbl = createPanel(form)
RpTbl.Left=0 RpTbl.Top=40 RpTbl.Height=135 RpTbl.Width=240
RpTbl.BevelWidth=5 RpTbl.Color=4259328
local RpBtn1 = createPanel(RpTbl)
RpBtn1.Left=10 RpBtn1.Top=15 RpBtn1.Height=26 RpBtn1.Width=220
local RpBtn2 = createPanel(RpTbl)
RpBtn2.Left=10 RpBtn2.Top=55 RpBtn2.Height=26 RpBtn2.Width=220
local RpBtn3 = createPanel(RpTbl)
RpBtn3.Left=10 RpBtn3.Top=95 RpBtn3.Height=26 RpBtn3.Width=220
function panelClickEffect(item2, text)
local color1=clDefault
item2.BevelColor=color1
item2.BevelWidth=3
item2.Font.Size=10 --item2.BevelInner="bvRaised" item2.BevelWidth=3 item2.Font.Color="0x000000"
item2.Font.Style="fsBold" item2.ShowHint=true item2.OptimalFill=true
item2.Font.Name="Georgia" item2.Cursor=-21 item2.Color="16760576"
item2.caption = text
item2.OnMouseMove=function() item2.BevelColor=0 end
item2.OnMouseLeave=function() item2.BevelColor=color1 end
item2.OnMouseDown=function() item2.Color="0x00ffff" end
item2.OnMouseUp=function() item2.Color="16760576" end
end
panelClickEffect(RpBtn1, "Click if the game is open!")
panelClickEffect(RpBtn2, "Hack Enable (is) [OFF]")
panelClickEffect(RpBtn3, "Close Trainer")
RpBtn2.Enabled=false
--########################## func ...
local check=true
RpBtn1.OnClick=function()
proc=getProcessIDFromProcessName("yourGame.exe") -- your game.exe
if proc~=nil then
RpBtn2.Enabled=true
openProcess(proc)
else
showMessage("Error! The game is not open!")
end
end
RpBtn2.OnClick=function()
addresslist=getAddressList()
CheatEntry1=addresslist_getMemoryRecordByDescription(addresslist,"SCRIPT - LOG - Item Drop")
CheatEntry2=addresslist_getMemoryRecordByDescription(addresslist,"SCRIPT - LOG - Room Number Change")
CheatEntry3=addresslist_getMemoryRecordByDescription(addresslist,"SCRIPT - LOG - Looking At Item")
if check==true then
CheatEntry1.Active=true
CheatEntry2.Active=true
CheatEntry3.Active=true
RpBtn2.caption="Hack Enable (is) [ON]"
showMessage("Hack has been activated.")
check=false
else
CheatEntry1.Active=false
CheatEntry2.Active=false
CheatEntry3.Active=false
RpBtn2.caption="Hack Enable (is) [OFF]"
showMessage("The hack is not active.")
check=true
end
end
RpBtn3.OnClick=function()
closeCE()
return cafree()
end |
_________________
Last edited by AylinCE on Sun Mar 13, 2022 11:39 am; edited 1 time in total |
|
Back to top |
|
 |
HotPieOnARack How do I cheat?
Reputation: 0
Joined: 15 Feb 2022 Posts: 7
|
Posted: Sat Mar 12, 2022 1:09 pm Post subject: |
|
|
Thank you very much, but the scripts still won't do anything if I run this as a standalone exe
Usually this should write a logfile (to console and to a target location)
Please see the screenshot of the result when I execute the script directly in Cheat Engine.
If I export it as standalone, I can connect the trainer with the app, I can activate the scripts ("Hack has been activated" msg shows) but then nothing happens anymore.
Last edited by HotPieOnARack on Sat Mar 12, 2022 5:06 pm; edited 2 times in total |
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1520
|
Posted: Sat Mar 12, 2022 3:09 pm Post subject: |
|
|
I think I completed the task.
I think another master on duty who understands asm can take a look at this.
Sorry, I don't use asm encoding.
_________________
|
|
Back to top |
|
 |
HotPieOnARack How do I cheat?
Reputation: 0
Joined: 15 Feb 2022 Posts: 7
|
Posted: Sat Mar 12, 2022 5:04 pm Post subject: |
|
|
Problem solved:
It's a bug in Cheatengine, but there is a workaround:
If you want to use Lua Codeblocks you have to add the luaclient.dll from the Cheatengine root folder manually.
cheatengine.org/viewtopic.php?t=618886
|
|
Back to top |
|
 |
|