Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


How to get the value of the memory read field when CE starts

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
24quant42
Cheater
Reputation: 0

Joined: 19 Apr 2023
Posts: 31

PostPosted: Sun Nov 19, 2023 10:25 am    Post subject: How to get the value of the memory read field when CE starts Reply with quote

I want to add a new text menu to the CE main screen.
This text should display the status of the parameter that is indicated in the picture. Also this script will be launched along with CE.

Can you help? Shocked



111.png
 Description:
 Filesize:  16.92 KB
 Viewed:  2236 Time(s)

111.png


Back to top
View user's profile Send private message  
Dark Byte
Site Admin
Reputation: 468

Joined: 09 May 2003
Posts: 25712
Location: The netherlands

PostPosted: Sun Nov 19, 2023 10:51 am    Post subject: Reply with quote

getSettingsForm().cbKernelReadWriteProcessMemory.checked
_________________
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
View user's profile Send private message MSN Messenger 
ICQ Number
24quant42
Cheater
Reputation: 0

Joined: 19 Apr 2023
Posts: 31

PostPosted: Sun Nov 19, 2023 12:51 pm    Post subject: Reply with quote

Dark Byte wrote:
getSettingsForm().cbKernelReadWriteProcessMemory.checked



Thanks for the answer, but the problem still remains.
I created test.lua and added it to the startup folder

Next I tried using cbKernelReadWriteProcessMemory.checked, but the MsgBox was empty when I started CE.
Next, I changed code "checked" on "State" and saw the number 0.

But the problem is that when I checked the checkboxes in CE and restarted CE, I saw MsgBox with the number 0, although I should have seen the number 1 (since the checkbox is enabled).

The most interesting thing is that if the script is used in an already running CE, for example in the LUA editor, then cbKernelReadWriteProcessMemory.State works correctly.


--Update
I'm guessing the problem is related to the order in which the scripts are loaded. Is there any way to run my script, the latest one?



222.png
 Description:
 Filesize:  16.81 KB
 Viewed:  2220 Time(s)

222.png


Back to top
View user's profile Send private message  
AylinCE
Grandmaster Cheater Supreme
Reputation: 35

Joined: 16 Feb 2017
Posts: 1486

PostPosted: Sun Nov 19, 2023 2:54 pm    Post subject: Reply with quote

Code:
mf = getMainForm()
cpt11 = ""

function sState11()
rwState1 = getSettingsForm().cbKernelReadWriteProcessMemory.State
 if rwState1==0 then
  cpt11 = "Read Write Process Memory: Disable"
 elseif rwState1==1 then
  cpt11 = "Read Write Process Memory: Enable"
 end
end
sState11()
if ReadWriteTim11 then ReadWriteTim11.Destroy() ReadWriteTim11=nil end
if ReadWriteLbl11 then ReadWriteLbl11.Destroy() ReadWriteLbl11=nil end

ReadWriteLbl11 = createLabel(mf.Panel5)
ReadWriteLbl11.Name = "ReadWriteLbl11"
ReadWriteLbl11.AutoSize=false
ReadWriteLbl11.Parent = mf.Panel5
ReadWriteLbl11.Height=22
ReadWriteLbl11.Width=220
ReadWriteLbl11.Top = tonumber(mf.Panel5.Height) - 45
ReadWriteLbl11.Left = tonumber(mf.Panel5.Width) - 230
ReadWriteLbl11.Font.Style="fsBold"
ReadWriteLbl11.Font.Size=14
ReadWriteLbl11.OptimalFill = true
ReadWriteLbl11.bringToFront()
ReadWriteLbl11.Caption = cpt11
ReadWriteLbl11.Cursor = -21
ReadWriteLbl11.ShowHint = true
ReadWriteLbl11.Hint = "Click to read closed!\nChange: Settings>>Extra\nChange the selection and confirm."

mf.Panel5.OnResize=function()
ReadWriteLbl11.Top = tonumber(mf.Panel5.Height) - 45
ReadWriteLbl11.Left = tonumber(mf.Panel5.Width) - 230
end

ReadWriteTim11=createTimer(mf)
ReadWriteTim11.Interval=1000 ReadWriteTim11.Enabled=true

ReadWriteLbl11.OnClick=function()
 if ReadWriteTim11.Enabled==true then
   ReadWriteTim11.Enabled=false
 else
   ReadWriteTim11.Enabled=true
 end
sState11()
end

ReadWriteTim11.OnTimer=function()
 sState11()
 ReadWriteLbl11.Caption = cpt11
end
-- Syntax
--getSettingsForm().cbKernelReadWriteProcessMemory.Checked = true -- or false
--reloadSettingsFromRegistry() -- save refresh value..


You can put the code in a *lua file, give it a name like "zzzReadWriteProcess.lua" and drop it into the CE>>autorun folder.

EDIT: I think this is the code you want.

Copy this code and run it in CE Lua Table.
It will put the code you want in the "autorun" folder.
Then open a new CE window and test.

Code:
folderPath1 = getAutorunPath()

text11 = [==[

if ReadWriteTim11 then ReadWriteTim11.Destroy() ReadWriteTim11=nil end

ReadWriteTim11=createTimer(mf)
ReadWriteTim11.Interval=1000 ReadWriteTim11.Enabled=true

rwIndex = 0

function sState11()
cpt11 = ""
rwState1 = getSettingsForm().cbKernelReadWriteProcessMemory.State
 if rwState1==0 then
  cpt11 = "Read Write Process Memory: False"
 elseif rwState1==1 then
  cpt11 = "Read Write Process Memory: True"
 end
 return cpt11
end

function start11()
if ReadWriteTim11 then ReadWriteTim11.Destroy() ReadWriteTim11=nil end
out11 = sState11()
messageDialog(out11,mtWarning, mbOk)
end

ReadWriteTim11.OnTimer=function()
rwIndex = tonumber(rwIndex) + 1
  if rwIndex==3 then start11() end
end
]==]

local f1 = io.open(folderPath1.."\\zzzReadWriteProcess.lua", "w+")
f1:write(text11)
f1:close()



ek_1.PNG
 Description:
 Filesize:  8.8 KB
 Viewed:  2206 Time(s)

ek_1.PNG



_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
24quant42
Cheater
Reputation: 0

Joined: 19 Apr 2023
Posts: 31

PostPosted: Sun Nov 19, 2023 5:29 pm    Post subject: Reply with quote

thx Wink .To solve my problems I needed createTimer Laughing
Back to top
View user's profile Send private message  
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites