-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAuto.lua
More file actions
71 lines (57 loc) · 1.53 KB
/
Auto.lua
File metadata and controls
71 lines (57 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<LuaScript>
local proc = "EXENAME.exe"
local steamURL = "steam://rungameid/ID"
local max_wait_time = 5000
-- DO NOT MODIFY BELOW THIS LINE --
local addressList = getAddressList()
function Kill_CE()
os.execute("taskkill /F /IM cheatengine*")
end
function Kill_PROC()
os.execute("taskkill /F /IM " .. proc)
end
function Launch()
if not getProcessIDFromProcessName(proc) then
shellExecute(steamURL)
sleep(max_wait_time)
end
local ticks = 0
local maxTicks = max_wait_time
local tick = 100
while process ~= proc and ticks < maxTicks do
openProcess(proc)
sleep(tick)
ticks = ticks + tick
end
local totalRecords = addressList.Count
local activatedCount = 0
for i = 0, totalRecords - 1 do
local memRecord = addressList[i]
local activationSuccess, activationErr = pcall(function()
memRecord.Active = true
end)
if activationSuccess then
sleep(500)
if not memRecord.Active then
Kill_PROC()
messageDialog("Cheat activation failed on cheat #" .. i .. ". Process will be terminated.", mtError, mbOK)
Kill_CE()
return false
else
activatedCount = activatedCount + 1
end
else
Kill_PROC()
messageDialog("Error during activation of cheat #" .. i .. ": " .. (activationErr or "unknown error") .. ". Process will be terminated.", mtError, mbOK)
Kill_CE()
return false
end
end
while getProcessIDFromProcessName(proc) do
sleep(750)
end
Kill_CE()
return true
end
Launch()
</LuaScript>