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 


Address reference by Structure.Element [Solved]

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
paul44
Expert Cheater
Reputation: 2

Joined: 20 Jul 2017
Posts: 152

PostPosted: Sun Oct 03, 2021 8:03 am    Post subject: Address reference by Structure.Element [Solved] Reply with quote

I was unaware about this feature, till recently. And i would now like to write a function that produces/add such memrecord from within the 'Dissect Data structure' form:

goal: achieve [ https://imgur.com/icc75P9 ]

I see 2 approaches:
a) (preferable): add the currently selected Element to the addresslist, following right_Bottom convention (instead of left_bottom convention as done now)
> my issues: (no functions for ?)
1) how to get my currently selected element (i could always ask for current offset as workaround)
2) how to get parent of current structure.

b) use the left_bottom memrecord, to collect info from appropriate structures. that should definitely be do-able currently; but first want to know if a) is a no-go atm...


ps: in the image, the last offset should show 'Character.PrimaryActor...etc' (had not yet created a 'Character' struct for that)


Last edited by paul44 on Sat Oct 09, 2021 2:24 am; edited 1 time in total
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Sun Oct 03, 2021 1:35 pm    Post subject: Reply with quote

in the treenode of the structure window, the parent of nodes contain a pointer as integer to the structure it's describing in the children.

example on how to get/use that data:
Code:

elementStructure=integerToUserData(sf.tvStructureView.Selected.Parent.Data)
element=elementStructure.Element[sf.tvStructureView.Selected.Index]


and to get the current base address you can do:
Code:

sf=enumStructureForms()[1]

for i=0,sf.columnCount-1 do
  if sf.Column[i].Focused then
    printf("%x",sf.Column[i].Address)
  end
end

_________________
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
paul44
Expert Cheater
Reputation: 2

Joined: 20 Jul 2017
Posts: 152

PostPosted: Mon Oct 04, 2021 11:07 am    Post subject: in progress... Reply with quote

^ i have to admit that this is out of my comfortzone. but some quick googling gave me this: [ https://www.cheatengine.org/forum/viewtopic.php?p=5772907&sid=573f340a92f2055c24d4cd7386cab64a#5772907 ].

And once i understood what offsetlist[] collected, i basically got my solution... I've tried to collect the (sub)structure addresses (at each offset) in the while loop, but can't seem to get that working (for now). So did another loop with #offsetlist and using the Baseaddress of the 'main' structure (which i get from your abovementioned code).

-EDIT-
Got it worked out. If anyone is interested in the code, see here: [ https://fearlessrevolution.com/viewtopic.php?p=213846#p213846 ]
(example: [ https://imgur.com/a/qA2tWYh#52e5LQk ])

thx a mil 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