View previous topic :: View next topic |
Author |
Message |
mikey1993 Newbie cheater Reputation: 0
Joined: 20 Jul 2017 Posts: 22
|
Posted: Tue May 02, 2023 9:12 pm Post subject: How to use external libraries within Cheat Engine |
|
|
Hi guys. I was hoping for some guidance on how to incorporate external libraries within CEs Lua such as LuaSQL or LuaFileSystem.
In this case I wanted to use wxLua for GUI purposes like creating an overlay over the game and feed it data to display on the screen.
Any information or links to a guide would be appreciated. Thank you!
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25296 Location: The netherlands
|
Posted: Wed May 03, 2023 12:12 am Post subject: |
|
|
Depends on where it has to run (game or ce)
and how to use it.
normally you'd have to compile those libraries to the same version as ce's lua with the .lib files
But for you usage you want it to run inside the game. So you'll have to load lua itself into the target process and then use that to load the wxGui library and given it commands to generate a gui
But before you spend time on this, wxGui won't work as overlay for 3D games. If it's 3D then better look into a 3d overlay like ce's d3d hook. And then create sprites with the gui you prefer
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
mikey1993 Newbie cheater Reputation: 0
Joined: 20 Jul 2017 Posts: 22
|
Posted: Wed May 03, 2023 1:44 am Post subject: |
|
|
Thank you DB, I'll look into that. I tried following these instructions I found but I'm not sure how accurate they are. I get a nil return for "current_dir" variable. Could it be because I'm using a dll (lfs.dll) for Lua 5.3 ?
To use LuaFileSystem with Cheat Engine, you will need to follow these steps:
1. Download the latest version of LuaFileSystem
2. Copy the lfs.dll file from the luafilesystem-1.8.0\src directory to your Cheat Engine autorun directory. This directory is usually located in your Cheat Engine installation folder (e.g., C:\Program Files\Cheat Engine 7.3\autorun).
3. In your Lua script, add the following code to load the lfs library:
Code: | local lfs = package.loadlib("lfs.dll", "luaopen_lfs")() |
This will load the lfs.dll file and make the lfs module available for use in your script.
1. You can now use the lfs module functions in your script. For example, to get the current working directory, you can use the following code:
Code: | local current_dir = lfs.currentdir()
print(current_dir) |
Note: If you encounter any issues with loading the lfs module, make sure that you have the correct version of lfs.dll for your version of Lua and that it is located in the correct directory. You may also need to add the directory containing lfs.dll to your system's PATH environment variable.
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25296 Location: The netherlands
|
Posted: Wed May 03, 2023 2:32 am Post subject: |
|
|
first of, LFS is already part of CE's installation so you can just do lfs.currentdir()
(the lfs dll is in <cheatenginedir>\clib*\lfs.dll)
as for why the lfs.dll from the package doesn't work is because it's not compiled for ce's lua implementation. It expects to find a lua53.dll, which isn't there. There's only lua53-32.dll and lua53-64.dll
you need to compile lfs yourself and make it link against these dll's
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1260
|
Posted: Wed May 03, 2023 2:36 am Post subject: |
|
|
It looks like "lfs" is already defined in CE.
Code: | function lfsAttr(aa)
attr=lfs.attributes(aa)
if attr then
--file/folder exists
if attr.mode=='directory' then
print("folder exists")
else
print("It exists, but is no folder")
end
else
--file/folder does not exist
print("Does not exist")
end
end
scriptFile = getCheatEngineDir() --..'autorun'
local a1=(scriptFile..'myFolder')
local a2=(scriptFile..'languages')
print("********* a1 **********")
lfsAttr(a1)
print("********* a2 **********")
lfsAttr(a2) |
_________________
|
|
Back to top |
|
|
|