[Lua] [Snippet] Auto Attach to Process

Section's for general approaches on hacking various options in games. No online-related discussions/posts OR warez!
Post Reply
User avatar
TheyCallMeTim13
Fearless Donors
Fearless Donors
Posts: 295
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 69

[Lua] [Snippet] Auto Attach to Process

Post by TheyCallMeTim13 » Sat Apr 21, 2018 8:19 am

forum.cheatengine.org - auto attach to process
wiki.cheatengine.org - Tutorials:Lua:Setup_Auto_Attach

Lua:

Code: Select all

--------
-------- Auto Attach to Process
--------
PROCESS_NAME = 'Game.exe'
local autoAttachTimer = nil
local autoAttachTimerInterval = 100
local autoAttachTimerTicks = 0
local autoAttachTimerTickMax = 5000

local function autoAttachTimer_tick(timer)
    if autoAttachTimerTickMax > 0 and autoAttachTimerTicks >= autoAttachTimerTickMax then
        timer.destroy()
    end
    if getProcessIDFromProcessName(PROCESS_NAME) ~= nil then
        timer.destroy()
        openProcess(PROCESS_NAME)
    end
    autoAttachTimerTicks = autoAttachTimerTicks + 1
end

autoAttachTimer = createTimer(MainForm)
autoAttachTimer.Interval = autoAttachTimerInterval
autoAttachTimer.OnTimer = autoAttachTimer_tick
"We live in a society exquisitely dependent on science and technology, in which hardly anyone knows anything about science and technology."
-- Carl Sagan

Post Reply