rollin340 wrote: ↑Sun Sep 24, 2023 3:16 pm
I can't even get the $process to work properly. With CE on, Ctrl + Alt + L to open up the Lua script and ran:
Code: Select all
if process then
print('Attached to "' .. (process or 'NOTHING') .. '"')
else
print('Not Attached')
end
When attached to CE itself, I get:
Attached to "cheatengine-i386.exe"
When attached to BG3, I get:
Attached to ""
Using bg3_d11.exe doesn't work either. Tried with both CE 7.4 and 7.5; same results. No clue what's going on.
Sounds like your Cheat Engine is launched without elevated privileges, although I'm not sure how that's even possible. At least that would explain why CE only have access to its own process.
Try adding this to your Lua Script: Cheat Table, and execute the script:
Code: Select all
MainForm.OnProcessOpened = function (openedPID, processHandle, caption)
print('Opened process:')
print('Process ID: ', tostring(openedPID))
print('Process Handle: ', tostring(processHandle))
print('Process Caption: ', tostring(caption))
print('"process" global variable: ', tostring(process))
end
print('Welcome!')
All it does is print details about the opened process, when a process is opened. So after having executed the script, just try opening various processes and see what, if any, the output is.
Also, when just playing around/testing, I can recommend using the Lua Engine window (the one that's opened when
print()
ing to console). In this script window you have all sorts of benefits such as limited tab-completion (at least when working with forms) and code folding, not to mention to not having to switch between two windows to see the results. Some things (such as the OnProcessOpened function) must be in the Lua script: Cheat Table, I think.
Also, when printing variables that you don't know the type of, you can always convert it to a string before printing it, i.e.
print(tostring(process))
. That at least helps me to get a more "visual" understanding of what the variable might contain, if it doesn't return anything. I'm still new to Lua (and Cheat Engine), so I'm sure there are way better methods to peek into an unknown variable. I'm still looking for the equivalent to PowerShell
Get-Member