View previous topic :: View next topic |
Author |
Message |
Zom-G How do I cheat? Reputation: 0
Joined: 18 Sep 2010 Posts: 1
|
Posted: Fri Aug 07, 2015 9:45 am Post subject: Auto-attach |
|
|
I tried the auto-attach script found in another thread
Code: | aalist=getAutoAttachList()
stringlist_add(aalist,"myprogram.exe") |
but it seems it only works once, and then I have to close and re-open CE. Re-executing the script doesn't work.
How can I attach whenever I start myprogram.exe? (there will always be at most one instance of myprogram.exe running)
|
|
Back to top |
|
|
Smellyhobo101 Newbie cheater Reputation: 0
Joined: 21 Sep 2014 Posts: 23
|
Posted: Sun Aug 23, 2015 1:54 pm Post subject: |
|
|
I just figured out how to do this today.
Code: |
function attach() -- this function will be called every 5 seconds
GameID = getProcessIDFromProcessName("game.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("game.exe") -- Attach to the game process
end
end
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
|
getOpenedProcessID() returns the process ID of the process CE is currently attached to. It returns 0 if not attached to a process.
getProcessIDFromProcessName() returns the process ID of the process name. Will return a nil value if that process isnt running.
Every 5 seconds it will check if the ID of the process matches the ID of the process CE is currently attached to. If they don't match then it will try to attach to the process again. Be careful not to set the timer interval too high. I've found that getProcessIDFromProcessName() uses a lot of CPU when called frequently. With an interval of 50ms cheat engine was using 25% of my CPU, and I have an i5-4670k.
|
|
Back to top |
|
|
|