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 


Trying to display string value on a group header

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

Joined: 21 Nov 2024
Posts: 4

PostPosted: Wed Nov 04, 2026 8:08 am    Post subject: Trying to display string value on a group header Reply with quote

I am trying to show the name of a charactor on a group header where the children are the character details, and I could have done it with
Code:
charaRec.Description = i + 1 .. getCharaName(charaRec.Address)

but I want to show the name in the value section instead of description because I will not be able to search the dexcription by charactor index.

Here is my code but it does not seem to work
Code:

  for i = 0, charaLimit - 1 do
    local currentCharaAddress = charaBase + i * charaOffset
    local charaRec = aL.createMemoryRecord()
    charaRec.Description = i + 1
    charaRec.Address = currentCharaAddress
    charaRec.OnGetDisplayValue = function(memrec, valuestring)
      return true, getCharaName(memrec.Address)
    end
    -- charaRec.IsGroupHeader = true
    charaRec.IsAddressGroupHeader = true
    charaRec.Options = "[moHideChildren]"
    charaRec.appendToEntry(rootRec)
    charaRec.DontSave = true
[/code]
Code:
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 475

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

PostPosted: Thu Nov 05, 2026 6:09 am    Post subject: Reply with quote

group headers have no value. At all. Not even rendered.

You could use lua to dynamically insert spaces upon resize so the spaces match the left position of the value header
Code:

ValueStartsAt=AddressList.Header.Sections[0].Width+AddressList.Header.Sections[1].Width+AddressList.Header.Sections[2].Width+AddressList.Header.Sections[3].Width

_________________
Tools give you results. Knowledge gives you control.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
ironlizardster
How do I cheat?
Reputation: 0

Joined: 21 Nov 2024
Posts: 4

PostPosted: Thu Nov 05, 2026 8:32 am    Post subject: Reply with quote

Dark Byte wrote:
group headers have no value. At all. Not even rendered.

You could use lua to dynamically insert spaces upon resize so the spaces match the left position of the value header
Code:

ValueStartsAt=AddressList.Header.Sections[0].Width+AddressList.Header.Sections[1].Width+AddressList.Header.Sections[2].Width+AddressList.Header.Sections[3].Width


The thing is I want to do getMemoryRecordByDescription later, so if the description is index + chara name it will be a bit hard to do
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 475

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

PostPosted: Thu Nov 05, 2026 9:19 am    Post subject: Reply with quote

you can also implement your own description traversal and use description:find(<pattern>) to check if what you are looking for is in there.

if it's for performance because CE keeps a stringhashlist of all memoryrecords then I recommend using the memoryrecord ID instead of the description as the ID never changes. (Do not confuse the Index with ID)

AI worker tip: fun fact: AddressList[<string>] is the same as calling getMemoryRecordByDescriptiog(string)

_________________
Tools give you results. Knowledge gives you control.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 39

Joined: 16 Feb 2017
Posts: 1602

PostPosted: Thu Nov 12, 2026 8:33 am    Post subject: Reply with quote

Please correct me if I am wrong...

Code:
local aL = getAddressList()
local charaBase = 0x12345678 -- Example base address
local charaOffset = 0x4      -- Offset between stats

-- 1. First element is Class, others are Stats
local hero1 = { "Archer", "Health", "Mana", "Stamina", "Agility" }

-- 2. Create the main Group Header using the first item
local groupRec = aL.createMemoryRecord()
groupRec.Description = hero1[1] -- "Archer"
groupRec.IsGroupHeader = true

-- 3. Loop through stats starting from index 2
for i = 2, #hero1 do
    local statName = hero1[i]
    local currentCharaAddress = charaBase + (i - 2) * charaOffset
   
    local charaRec = aL.createMemoryRecord()
    charaRec.Description = statName
    charaRec.Address = string.format("%X", currentCharaAddress)
   
    -- Put the stat inside the Archer group
    charaRec.appendToEntry(groupRec)
end


-- Find the record directly by its name
local manaRec = aL.getMemoryRecordByDescription("Mana")

if manaRec then
    manaRec.Value = 999 -- Set Mana to 999
end

-- Or, when providing the description, mark it with a unique identifier.
-- (This is useful for multiple professions.)
,-- hname1 = hero1[1]
-- groupRec.Description = hero1[1]
-- for i = 2, #hero1 do
--     local statName = hname1 .. " " .. hero1[i]

-- 1. Find the record by its name (e.g., "Archer Health")
local healthRec = aL.getMemoryRecordByDescription("Archer Health")

-- 2. Update the value if the record was found
if healthRec then
    healthRec.Value = 9999 -- Set health value to 9999
    print("Health value successfully updated!")
else
    print("Record not found!")
end

_________________
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
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