| View previous topic :: View next topic |
| Author |
Message |
ironlizardster How do I cheat?
Reputation: 0
Joined: 21 Nov 2024 Posts: 4
|
Posted: Wed Nov 04, 2026 8:08 am Post subject: Trying to display string value on a group header |
|
|
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]
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 475
Joined: 09 May 2003 Posts: 26026 Location: The netherlands
|
Posted: Thu Nov 05, 2026 6:09 am Post subject: |
|
|
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 |
|
 |
ironlizardster How do I cheat?
Reputation: 0
Joined: 21 Nov 2024 Posts: 4
|
Posted: Thu Nov 05, 2026 8:32 am Post subject: |
|
|
| 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 |
|
 |
Dark Byte Site Admin
Reputation: 475
Joined: 09 May 2003 Posts: 26026 Location: The netherlands
|
Posted: Thu Nov 05, 2026 9:19 am Post subject: |
|
|
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 |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 39
Joined: 16 Feb 2017 Posts: 1602
|
Posted: Thu Nov 12, 2026 8:33 am Post subject: |
|
|
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
|
_________________
|
|
| Back to top |
|
 |
|