I want to display the value of the address specified in the description

Anything Cheat Engine related, bugs, suggestions, helping others, etc..
Post Reply
edomsa
Noobzor
Noobzor
Posts: 10
Joined: Wed Oct 31, 2018 9:42 am
Reputation: 1

I want to display the value of the address specified in the description

Post by edomsa »

Hello.

For example, if "456" is stored in the value of "address 00112233", how can I make the description automatically display "456"?

Thank you in advance.

User avatar
LeFiXER
LeFixer
LeFixer
Posts: 489
Joined: Wed Mar 24, 2021 9:35 am
Reputation: 251

Re: I want to display the value of the address specified in the description

Post by LeFiXER »

You can update the description of a memory record with Lua:

Code: Select all

local descriptionToDisplay = 'The value of  address [ 00112233 ] is: '
local entry = getAddressList().getMemoryRecordByDescription('the text which is in the description section goes here')
if entry then
   entry.Description = descriptionToDisplay .. entry.Value
end

panraven
Table Makers
Table Makers
Posts: 129
Joined: Fri Mar 03, 2017 12:03 am
Reputation: 118

Re: I want to display the value of the address specified in the description

Post by panraven »

Check this 1st viewtopic.php?p=345558#p345558
Then the function can be :

Code: Select all

local al = GetAddressList()
local mr = al.getMemoryRecordByID(1234) -- your target record
if mr then
  mr.OnGetDisplayValue = function(mr, val)
    mr.Description = val -- it may depend on other attribute of the mr, eg if it displayed as hex or signed etc
  end
end
another example:

Code: Select all

...
  mr.OnGetDisplayValue = function(mr, val) 
  -- avoid attribute check to have a consistent hex display, which work also for float type 
    local v, a = mr.NumericalValue, mr.currentAddress
    v = math.tointeger(v) and string.format('0x%X',v) or val
    mr.Description = string.format('%s @ %X', v, a) -- a is 0 if the address is no known
  end
...
The function does not change the 'Value' displayed (no return true, <changed_display>),
but use onGetDispalyValue as a onTimer function to auto-update the Description instead.
But the description may change, we should identify the memory record by other way but not description,
for example, by its ID (copy the record, paste it in editor to lookup it from the xml )

edomsa
Noobzor
Noobzor
Posts: 10
Joined: Wed Oct 31, 2018 9:42 am
Reputation: 1

Re: I want to display the value of the address specified in the description

Post by edomsa »

LeFiXER wrote:
Sat Apr 06, 2024 10:04 pm
You can update the description of a memory record with Lua:

Code: Select all

local descriptionToDisplay = 'The value of  address [ 00112233 ] is: '
local entry = getAddressList().getMemoryRecordByDescription('the text which is in the description section goes here')
if entry then
   entry.Description = descriptionToDisplay .. entry.Value
end
panraven wrote:
Sat Apr 06, 2024 11:31 pm
Check this 1st viewtopic.php?p=345558#p345558
Then the function can be :

Code: Select all

local al = GetAddressList()
local mr = al.getMemoryRecordByID(1234) -- your target record
if mr then
  mr.OnGetDisplayValue = function(mr, val)
    mr.Description = val -- it may depend on other attribute of the mr, eg if it displayed as hex or signed etc
  end
end
another example:

Code: Select all

...
  mr.OnGetDisplayValue = function(mr, val) 
  -- avoid attribute check to have a consistent hex display, which work also for float type 
    local v, a = mr.NumericalValue, mr.currentAddress
    v = math.tointeger(v) and string.format('0x%X',v) or val
    mr.Description = string.format('%s @ %X', v, a) -- a is 0 if the address is no known
  end
...
The function does not change the 'Value' displayed (no return true, <changed_display>),
but use onGetDispalyValue as a onTimer function to auto-update the Description instead.
But the description may change, we should identify the memory record by other way but not description,
for example, by its ID (copy the record, paste it in editor to lookup it from the xml )
Thanks to you, I can now display the value in the description!
Thank you so much!

Post Reply

Who is online

Users browsing this forum: layzdevil