[Lua] ASAP: Automatic Script Activator and Process-Attacher

Upload *YOUR* gamehacking tools/helpers here
Post Reply
fakerlol
Novice Cheater
Novice Cheater
Posts: 17
Joined: Sat Mar 17, 2018 4:01 am
Reputation: 14

[Lua] ASAP: Automatic Script Activator and Process-Attacher

Post by fakerlol »

Were you ever so lazy to manually attach CE to your game's process and confirm the loading of the corresponding cheat-table every single time you wanted to play?
Well, I was. And what does somebody do who's to lazy to do a simple thing? Yes, they go about putting ten times the work in to automate it!

Automatic Attachment & Table loading
Once dropped into the autorun-folder, the lua-script will then scan the list of currently running processes for names that correspond to CheatTables contained in your 'My Cheat Tables'-folder. Once a match has been found, CE automatically attaches to the process and loads the corresponding CheatTable by itself - no more clicking required.

:arrow: Experimental: This lua-script will try to activate the DataCollector, when the attached process appears to have .NET or mono libraries amidst their modules.

:!: Current limitations: Once a match has been found and the table has been loaded, the script shuts down. The match happens in no particular order. So if you have a CheatTable that corresponds to several processes of the same name (e.g. browsers) or have more than one game running at a time, you'll have no real benefit using this script.

Automatic Script activation
So if you're like me and want to even automate the activation of your AutoAssembler-Scripts, worry not!
All you have to do is preface your scripts with {!activate} and once the table is loaded into CE, the script will be activated automatically.
Don't want to activate it with the table-loading? No problems! Just define a delay via {!activate[, delayInMillisecs]}.

:!: Current limitations: {!activate} has to be the first thing in your script. If you have anything other than whitespaces before that, the particular script won't be automatically activated.

This short example shows how the script will be activated after 2500ms:

Code: Select all

{!activate, 2500}
[ENABLE]
aobscanmodule(.....)
registersymbol(...)
 ....
[DISABLE]
 ....
Attachments
automaticProcessOpener_1.1.7.zip
Extract into the 'autorun'-folder contained in your CheatEngine-Installation-Path.
PW: noOrdinaryFaker
(3.23 KiB) Downloaded 1972 times

Vinnie_Irish
Noobzor
Noobzor
Posts: 8
Joined: Mon Jan 09, 2023 12:13 pm
Reputation: 1

Re: [Lua] ASAP: Automatic Script Activator and Process-Attacher

Post by Vinnie_Irish »

Not to worry, I managed to get it right using your CT file and explanation.

Many thanks once again.
Shaun
Last edited by Vinnie_Irish on Wed Feb 15, 2023 12:55 pm, edited 1 time in total.

fakerlol
Novice Cheater
Novice Cheater
Posts: 17
Joined: Sat Mar 17, 2018 4:01 am
Reputation: 14

Re: [Lua] ASAP: Automatic Script Activator and Process-Attacher

Post by fakerlol »

Vinnie_Irish wrote:
Tue Jan 10, 2023 8:28 am
Hi there,

Thanks for putting this lua script together, it seems like exactly what I need. I'm very new to this and I was wondering if you could help me out a bit? Even with your easy instructions, I've not managed to get this right :cry: ...

What I've done so far:

1) I've copied the lua script to the autorun folder in the Cheat Engine folder:
C:\Program Files\Cheat Engine 7.4\autorun\automaticProcessOpener.lua


2) I've only edited the part in your lua script that needs to point to my Cheat table folder, as per below in red:

Change this variable to your desired path if you have your Cheat-Tables stored in a different folder
Example: tablesDir = "E:\\My Super Secret Files\\My CE Tables"
--]]
tablesDir = getSettings()['F:\\Documents\\My Cheat Tables'],
[...]

Any help and advice would be greatly appreciated.
Cheers
Shaun
Hi Shaun!
Please excuse the late reply, I didn't really think that people would use this lua-script so I didn't really check on the thread :D

So the problem you're having right now stems from a slight misunderstanding. You see, getSettings() will return an associative array, so I was just lazy to assign the table to a variable first. Normally it would look like this:

Code: Select all

local _ceSettings = getSettings()
tablesDir = _ceSettings['Initial tables dir']
So the code accesses the value of the setting named "Initial tables dir", which is in your Documents-Folder as by the CheatEngines' default. So what you're doing is trying to access a value in that settings-array that won't exist.

The answer to this problem was in plain sight all along, here colored as green.
Replace tablesDir = getSettings()['F:\\Documents\\My Cheat Tables'], with tablesDir = 'F:\\Documents\\My Cheat Tables', and the script should be able to match the CheatEngine-Tables with the process names :)

Vinnie_Irish
Noobzor
Noobzor
Posts: 8
Joined: Mon Jan 09, 2023 12:13 pm
Reputation: 1

Re: [Lua] ASAP: Automatic Script Activator and Process-Attacher

Post by Vinnie_Irish »

Not to worry, I managed to get it right using your CT file and explanation.

Many thanks once again.
Shaun

User avatar
igromanru
Table Makers
Table Makers
Posts: 336
Joined: Sat Mar 25, 2017 11:20 pm
Reputation: 478

Re: [Lua] ASAP: Automatic Script Activator and Process-Attacher

Post by igromanru »

I just recently started to add auto attach scripts to my tables and the post caught my attention.
Don't you find the 266 lines lua script overkill?
For me a simple timer does the trick:

Code: Select all

local processName = "Game Process.exe"
local function onTimer_Tick(timer)
  if readInteger(processName) == nil then
    local processId = getProcessIDFromProcessName(processName)
    if processId and processId ~= getOpenedProcessID() then
      openProcess(processId)
    end
  end
end
local autoAttachTimer = createTimer(getMainForm(), true)
autoAttachTimer.Interval = 1000
autoAttachTimer.OnTimer = onTimer_Tick
readInteger(processName) is a simple check if the process still exists. If the CE is still "attached" to a process that doesn't exist anymore, it will return nil.
You can simple add LaunchMonoDataCollector() after openProcess to activate mono feature automatically. Maybe with a small Sleep in between. I personally launch mono in my initial script, which also updates offsets etc.

Post Reply

Who is online

Users browsing this forum: A1ma, kizune, locust78