View previous topic :: View next topic |
Author |
Message |
kinako How do I cheat? Reputation: 0
Joined: 09 Jan 2022 Posts: 9 Location: Japan
|
Posted: Thu Jan 13, 2022 8:41 am Post subject: Save value |
|
|
I want to save the current value when I press the save button and reflect that value when I press the load button (I want to keep the data even if I close the game and exit the cheat engine) This cannot be saved Game progress Situation I wanted to save the status. |
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1055 Location: 0x90
|
Posted: Thu Jan 13, 2022 10:04 am Post subject: |
|
|
Read the value, save the value to a text file. Reload the game then read the value from the text file and write the value. |
|
Back to top |
|
|
kinako How do I cheat? Reputation: 0
Joined: 09 Jan 2022 Posts: 9 Location: Japan
|
Posted: Thu Jan 13, 2022 10:21 am Post subject: |
|
|
thank you for your reply. that is
How can I write and read? |
|
Back to top |
|
|
ByTransient Expert Cheater Reputation: 5
Joined: 05 Sep 2020 Posts: 240
|
|
Back to top |
|
|
kinako How do I cheat? Reputation: 0
Joined: 09 Jan 2022 Posts: 9 Location: Japan
|
Posted: Fri Jan 14, 2022 7:58 am Post subject: |
|
|
I saw it but it didn't work |
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1055 Location: 0x90
|
Posted: Fri Jan 14, 2022 11:23 am Post subject: |
|
|
kinako wrote: | I saw it but it didn't work |
It is a very broad statement. What is it? What didn't work? What error messages did you see? |
|
Back to top |
|
|
ByTransient Expert Cheater Reputation: 5
Joined: 05 Sep 2020 Posts: 240
|
Posted: Sat Jan 15, 2022 8:24 am Post subject: |
|
|
1) Save: Saves the address list to a txt file, also copies it to the first list box. Note: Make sure you type the listing name in the box next to the button.
2) DescSave: Saves the change made in the first list box to the file named in the first edit box.
3) Load: Loads the data in the txt file with the name written in the edit box next to it, into the second list box.
4) Auto Save: When clicked and "true", it automatically saves the address list to the named file in the first edit box. (The default recording interval is 1.5 seconds)
5) Open Save Folder: Opens the folder containing the records (.txt files).
6) Add Address List: Adds the entire list in the second list box to the Address list.
7) Optional: If any row is double-clicked in the second list box, the clicked row is added to the Address list.
Edit or use the code you need from inside.
Code: | function StartLogger()
if f then f.destroy() f = nil end
f = createForm()
f.Position=poDesktopCenter f.Width=525 f.Height=275
f.caption="Address List Recorder"
local m1=createMemo(f)
m1.Height=180 m1.Left=10 m1.Top=50 m1.Width=240
m1.WordWrap=false m1.ScrollBars="ssAutoBoth"
local m2=createMemo(f)
m2.Height=180 m2.Left=275 m2.Top=50 m2.Width=240
m2.WordWrap=false m2.ScrollBars="ssAutoBoth"
local b1=createButton(f)
b1.Left=10 b1.Top=12 b1.caption="Save"
local b2=createButton(f)
b2.Left=439 b2.Top=12 b2.caption="Load"
local b3=createButton(f)
b3.Left=395 b3.Top=240 b3.caption="Add Address List" b3.Width=120
local b4=createButton(f)
b4.Left=10 b4.Top=240 b4.caption="Auto Save - false" b4.Width=120
local b5=createButton(f)
b5.Left=202 b5.Top=240 b5.caption="Open Save Folder" b5.Width=121
local b6=createButton(f)
b6.Left=220 b6.Top=12 b6.caption="DescSave" b6.Width=85
local e1=createEdit(f)
e1.Left=95 e1.Top=13 e1.Width=115 e1.ShowHint=true e1.TextHint="Save File Name?"
local e2=createEdit(f)
e2.Left=315 e2.Top=13 e2.Width=115 e2.ShowHint=true e2.TextHint="Load File Name?"
--############################################################################--
local sf = getCheatEngineDir().."\\autorun\\"
if sf then
os.execute([[mkdir "]]..sf..[[\MyHackList"]])
end
pth = (sf.."MyHackList\\") --or pth=[[C:\Users\username\Desktop\MyHackList\]]
b5.OnClick=function()
shellExecute(pth)
end
function ListSave()
--local index = 1
local text=pth..e1.Text..".txt"
if text then
local settingsFile = io.open(text, "w")
if (settingsFile ~= nil) then
settingsFile:write(control_getCaption(m1))
settingsFile:close()
end
end
end
function ListLoad() --Memo2
local text2=pth..e2.Text..".txt"
if text2 then
local settingsFile = io.open(text2, "r")
if (settingsFile ~= nil) then
m2.Lines.Text = settingsFile:read("*a"):gsub("\n\r", "")
settingsFile:close()
end
end
end
--openProcess("chrome.exe")
local values=""
if addrrt then addrrt.destroy() end
addrrt = createTimer() --or auto "true"
addrrt.Interval=1500 addrrt.Enabled=false
function loadList()
sleep(100)
local al=GetAddressList()
for i=0, al.Count-1 do
values=(i.."___"..al[i].Description.."___"..al[i].Address.."___"..al[i].Value.."___\n"):gsub(' ','_');
m1.Lines.Add(values)
end
sleep(300)
ListSave()
end
b3.OnClick=function()
if m2.Lines.Text=="" then
showMessage("The list does not exist, please create a list from the 'Load' button.")
else
local al = getAddressList()
sleep(100)
for i=0, m2.Lines.count-1 do
local almr = al.createMemoryRecord()
des, addrr, vle=string.match(m2.Lines[i],"___(.-)___(.-)___(.-)___")
almr.Description=des
almr.Address=addrr
almr.Value=vle
end
end
end
m2.OnDblClick=function(sender, button, x, y)
local al = getAddressList()
local caption=(m2.SelText):gsub(' ','_');
counts=string.match(caption,"(.-)___")
counts=tonumber(counts)
caption=m2.Lines[counts]
sleep(100)
if caption==nil then
showMessage("Please select the line number at the beginning of the line.")
else
local almr = al.createMemoryRecord()
des, addrr=string.match(caption,"___(.-)___(.-)___(.-)___")
almr.Description=des
almr.Address=addrr
almr.Value=vle
end
end
b1.OnClick=function() if e1.Text=="" then
showMessage("Please enter a valid list name!")
else loadList() end end
b2.OnClick=function() if e2.Text=="" then
showMessage("Please enter a valid list name!")
else ListLoad() end end
b4.OnClick=function() if e1.Text=="" then
showMessage("Please enter a valid list name!")
else if addrrt.Enabled==false then
addrrt.Enabled=true
b4.caption="Auto Save - true"
else
addrrt.Enabled=false
b4.caption="Auto Save - false"
end
end
end
b6.OnClick=function() if e1.Text=="" then
showMessage("Please enter a valid list name!")
else ListSave() end end
addrrt.OnTimer=ListSave
end
StartLogger() |
If you want to use this code in CE menu add below code and pack all code as ".lua" and drop it in CE>>autorun folder.
Code: | --StartLogger()
mf=getMainForm()
mainmenu=mf.Menu.Items
topmenuitem=createMenuItem(mf.mainmenu)
topmenuitem.Caption="SaveAddr"
mainmenu.insert(mainmenu.Count-1, topmenuitem)
loggermenuitem=createMenuItem(topmenuitem)
menuItem_setCaption(loggermenuitem,"AddressRecorder")
menuItem_setShortcut(loggermenuitem,"Ctrl+R")
menuItem_onClick(loggermenuitem, StartLogger)
menuItem_add(topmenuitem, loggermenuitem) |
For more see here:
https://forum.cheatengine.org/search.php |
|
Back to top |
|
|
kinako How do I cheat? Reputation: 0
Joined: 09 Jan 2022 Posts: 9 Location: Japan
|
Posted: Sat Jan 15, 2022 12:03 pm Post subject: |
|
|
My explanation was inadequate.
What I want to do is to add a save function in LUA to a form that I have already created on my end.
All I want to do is get the value from the given address (no input box needed, it will be pre-filled by LUA), write it to the text, save it when I click the save button, load it when I click the load button, and replace the value.
Sorry, but I don't know much about this kind of complexity.
I could do it if I knew how to output to TXT (specify a directory if possible), how to load and replace, and how to get the current value from the address.
I'm sorry if I'm being selfish.
But that was not what I was looking for. |
|
Back to top |
|
|
ByTransient Expert Cheater Reputation: 5
Joined: 05 Sep 2020 Posts: 240
|
Posted: Sat Jan 15, 2022 1:06 pm Post subject: |
|
|
Code: | local sf = os.getenv("USERPROFILE") .. "\\Documents\\";
if sf then
os.execute([[mkdir "]]..sf..[[\MyHackList1"]]) -- create folder
end
local pth=sf..[[MyHackList1\]] -- or sf.."My Cheat Tables\\"
--print(pth)
function ListLoad(fileName)
local name = pth..fileName..".txt"
local text2=""
if name then
local settingsFile = io.open(name, "r")
if (settingsFile ~= nil) then
text2 = settingsFile:read("*a")
settingsFile:close()
end
end
--print("load: "..text2)
return text2
end
function ListSave(val,fileName)
local name = pth..fileName..".txt" --"yourSaveFileName.txt"
--print("name: "..name)
--print(text.." - "..val)
if name then
local settingsFile = io.open(name, "w")
if (settingsFile ~= nil) then
settingsFile:write(val)
settingsFile:close()
end
end
end
--rst=(readInteger("06D01524")) -- your address?
--print(rst)
--UDF1.CEButton1.OnClick=function() --save button function
ListSave(readInteger("06D01524"),"yourSaveFileName")
--end
--UDF1.CEButton2.OnClick=function() --load button function
--rst1=ListLoad("yourSaveFileName")
--print("rst1: "..rst1)
--end |
|
|
Back to top |
|
|
kinako How do I cheat? Reputation: 0
Joined: 09 Jan 2022 Posts: 9 Location: Japan
|
Posted: Tue Jan 18, 2022 7:29 am Post subject: |
|
|
If you enter the base address, it will not be saved properly. How do you handle the base address?
Or how do you handle this with a pointer? |
|
Back to top |
|
|
|