Jump to content
Moopler Closing Read more... ×
Sign in to follow this  

Information Auto Attach - Cheat Engine Tip

Recommended Posts

Hey guys, I just wanted to share a simple tip for ppl who might be hacking using cheat engine. If you find yourself having to reopen a game like MapleStory a lot after it crashes and/or Cheat Engine, you can use Cheat Engine's scripting to automate the process of finding the MS process, attaching it, when cheat engine opens. 


First you locate your cheat engine installation directory, go to the autorun folder. Then you right click the folder, create a new text document, and copy & paste the following script in it: 


function attach() -- this function will be called every 5 seconds

GameID = getProcessIDFromProcessName("MapleSilver.exe") -- Get the Process ID of the game process

-- If CE is attached to the wrong process AND the game is running
if GameID ~= getOpenedProcessID() and GameID ~= nil then
   openProcess("MapleSilver.exe") --  Attach to the game process


t = createTimer(nil, false)  -- create a Timer object and assign it to variable t.
timer_onTimer(t, attach)   -- When the timer ticks, call the function main
timer_setInterval(t, 5000) -- Sets the interval of the timer in milliseconds
timer_setEnabled(t, true) -- Turns the timer on


Change the process name to the name of the game process you want and the interval in milliseconds you want. For me I'm using MapleSilver.exe and 5000 so that it checks every 5 seconds if the game is running to attach to it automatically. After you modify the script to your needs, save, and then change the extension from .txt to .lua . Now when you open cheat engine, every 5 seconds, it automatically attaches to the game process.

To take this one step further, you can create a exe that runs and when you click on a button, a timer starts and automatically reopens the game on a specific interval. You can also have another button that activates a timer to check if cheat engine is running, and if not automatically open it. Some basic code I used: ShellExecute("open", path, 0, 0, SW_Show); //Inside the button click event to open the process, and FindWindow(0, "MapleStory"); //Inside the timer tick event to check if window exists (if it returns 0, it doesn't). 

A Use Case Scenario:

Say you are trying to hook a function, but you get the parameters wrong, and you're trying different stuff while debugging to make sure the stack is proper, if the stack is corrupted, cheat engine can crash, along with the game itself. So in this scenario, the program you made, auto restarts the game, auto restarts cheat engine, automatically attaches to the game in cheat engine, and then you can go back to the address you were debugging without having to do more stuff. 

Anyways this is all stuff that makes the process a bit more efficient. It's like Elon Musk spending time working on the robots that create the tesla cars. In the end, you might save time by using this script and creating a program that automatically reopens the game/cheatengine whenever one or both crashes. 

Hope this helps some of you out there :)


To disable the UAC popups once your program calls MS/Cheat Engine, follow this guide: https://mynuuo.zendesk.com/hc/en-us/articles/360000764413-How-to-disable-UAC-for-a-specific-program

Edited by JP.
  • Like 2
  • Thanks 2

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this