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 iterate over items in the form?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Dirael
How do I cheat?
Reputation: 0

Joined: 16 Oct 2022
Posts: 6
Location: Planet Earth

PostPosted: Tue May 07, 2024 3:01 pm    Post subject: How to iterate over items in the form? Reply with quote

I'm trying to modify "Select current function" item in the Memory View Form, accessing it with this code:
Code:
local form = getMemoryViewForm()
local item = form.MenuItem2


It used to work on CE 7.4 but doesn't work on 7.5. I reckon there might've been some changes. I'd like to know how I can iterate over Memory View's items until I find the correct class name using Caption for comparison.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 147

Joined: 06 Jul 2014
Posts: 4527

PostPosted: Tue May 07, 2024 3:27 pm    Post subject: Reply with quote

I'd just look at the source code. Find the relevant lfm file (i.e. Cheat Engine/MemoryBrowserFormUnit.lfm) and search for the caption of the GUI component you want to find. The name is how you access it.
Code:
local mi = getMemoryViewForm().miSelectCurrentFunction

If you really want to iterate over components:
Code:
local form = getMemoryViewForm()
for i = 0, form.ComponentCount - 1 do
  local c = form.Component[i]
  print(c.Name)
end
Most things are owned by the form itself, but if you want everything, you'll need to do that recursively.
_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Dirael
How do I cheat?
Reputation: 0

Joined: 16 Oct 2022
Posts: 6
Location: Planet Earth

PostPosted: Tue May 07, 2024 11:44 pm    Post subject: Reply with quote

You're the best, ParkourPenguin. That's exactly what I wanted to know Wink
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