View previous topic :: View next topic |
Author |
Message |
Csimbi I post too much
Reputation: 97
Joined: 14 Jul 2007 Posts: 3312
|
Posted: Sat May 31, 2025 3:52 am Post subject: Sideloading data from file |
|
|
Hello LUA Masters!
I would like to save data next to the CT file, in a (preferably) text-based file, load the data from the file whenever the user enables the script and save it whenever the user changes some variable.
INI files come to mind and I found https://github.com/Dynodzzo/Lua_INI_Parser so I am thinking about using that.
If there are better practices, please let me know!
Anyhow, what I would like to understand is how does one locate the file.
- Is there a property for "my cheat table" so the memoryrecord could find out its own CT path?
- Is there a "last opened" somewhere?
- Is there a call to get the name of the CT file?
Thank you!
Last edited by Csimbi on Sat May 31, 2025 8:08 am; edited 1 time in total |
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 36
Joined: 16 Feb 2017 Posts: 1499
|
Posted: Sat May 31, 2025 7:41 am Post subject: |
|
|
Which of these solutions approaches the problem?
Get the name or path of the opened table (.CT):
( autorun lua code ..)
Code: | mf = getMainForm()
if titleTmr then titleTmr.Destroy() titleTmr=nil end
titleTmr = createTimer(mf)
titleTmr.Interval = 2000
titleTmr.OnTimer=function()
title = mf.SaveDialog1 or mf.OpenDialog1 or nil
filefullpath = title.Filename
pathCut = extractFileName(filefullpath)
if filefullpath then
print(filefullpath)
print(pathCut)
-- load codes
else
print("no title or: " .. mf.caption)
end
titleTmr.Destroy()
end
titleTmr.Enabled=true |
Edit, save or replace:
https://forum.cheatengine.org/viewtopic.php?p=5778791#5778791
I think I deserve a little more explanation.
_________________
|
|
Back to top |
|
 |
Csimbi I post too much
Reputation: 97
Joined: 14 Jul 2007 Posts: 3312
|
Posted: Sat May 31, 2025 8:06 am Post subject: |
|
|
Much obliged, thank you!
I cut out the timer code and I used this:
Code: | mf = getMainForm()
title = mf.SaveDialog1 or mf.OpenDialog1 or nil
filefullpath = title.Filename
pathCut = extractFileName(filefullpath)
if filefullpath then
print(filefullpath)
print(pathCut)
-- load codes
else
print("no title or: " .. mf.caption)
end
|
Works great, thanks!
|
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 36
Joined: 16 Feb 2017 Posts: 1499
|
Posted: Sat May 31, 2025 9:59 am Post subject: |
|
|
If you are going to use the code with the lua package in the autorun folder, you need to start it with a delay to get the correct result.
If the delay is set to 2-3 seconds with the timer, the program (CT) will not conflict with the loading process and will find a stable reading area.
Also, if you are thinking of using the code globally, you can visit the link below and consider the solution that makes it suitable for "OneDrive" or ASCII characters.
https://forum.cheatengine.org/viewtopic.php?p=5793327#5793327
...
_________________
|
|
Back to top |
|
 |
Csimbi I post too much
Reputation: 97
Joined: 14 Jul 2007 Posts: 3312
|
Posted: Sat May 31, 2025 11:34 am Post subject: |
|
|
Now you are trying to spoil me
Local files are good enough for me.
I actually got it working.
Full autoload when script is enabled and autosave when settings I interested in change.
Playtesting it now.
Thanks!
|
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 36
Joined: 16 Feb 2017 Posts: 1499
|
Posted: Sat May 31, 2025 1:35 pm Post subject: |
|
|
Ahh, if the code is currently doing a sufficient job, that's fine.
Ignore this, I'm just observing the details out loud..
_________________
|
|
Back to top |
|
 |
|