mgr.inz.Player I post too much
Reputation: 222 Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Mon Dec 19, 2011 8:12 pm Post subject: Trainer [standalone]. Save/Load settings. |
|
|
I was intrigued by this topic: http://forum.cheatengine.org/viewtopic.php?t=544107
For now, all CE6 standalone trainers are extracting all needed files to: %temp%\cetrainers\CET{random}.tmp\extracted\
getCheatEngineDir() leads to above temporary folder.
and io.open("file.txt", "r") opens file.txt inside "extracted" folder
But how to get the trainer real path and use it? I made small modification to standalonephase2.dat file
([url=link down]download[/url]) (copy/paste/overwrite original) (backup original)
(DIFF)
Modified standalonephase2.dat causes additional file named TrainerRealPath.txt (yes, it's a pretty lame name ) to be created inside extracted directory - just after you launch your trainer but before it unpacks the needed files.
Now with this Lua code and standalonephase2.dat you can get trainer real path:
Code: | function getTrainerRealPath()
local t
local f = io.open("TrainerRealPath.txt", "r")
if (f ~= nil) then
t = f:read("*all")
f:close()
else
t = nil
end
return t
end |
You can use it to save trainer user options/settings (or logs, stats, etc)
for example:
Code: | MyPath = getTrainerRealPath() -- Trainer real path
function SaveSettings()
if MyPath then
settingsFile = io.open(MyPath.."Settings.ini", "w")
if (settingsFile ~= nil) then
settingsFile:write(control_getCaption(EDIT1).."\n") --diamonds
settingsFile:write(control_getCaption(EDIT2)) --playerspeed
settingsFile:close()
end
end
end
function LoadSettings()
if MyPath then
settingsFile = io.open(MyPath.."Settings.ini", "r")
if (settingsFile ~= nil) then
tmpAddDiamonds = settingsFile:read() --read line
tmpPlayerSpeed = settingsFile:read() --read line
settingsFile:close()
end
end
end |
Here, you have trainer ( it only loads values from file named settings.ini and saves all values when trainer is closed ) :
- standalone demo trainer (EXE file) [url=link down]LINK[/url]
- CT file (attachment). Of course "save settings", "load settings" do not work for CT and CETRAINER.
Edit:
Use TrainerOrigin instead. (variable added in CE6.2) _________________ Dark Souls II Item Swap and Item List
My Borderlands2 tables
Recent CheatEngine builds
Last edited by mgr.inz.Player on Wed Apr 03, 2013 6:45 pm; edited 1 time in total
|
|