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.
I want to display the value of the address specified in the description
Re: I want to display the value of the address specified in the description
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
Re: I want to display the value of the address specified in the description
Check this 1st viewtopic.php?p=345558#p345558
Then the function can be :
another example:
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 )
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
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
...
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 )
Re: I want to display the value of the address specified in the description
LeFiXER wrote: ↑Sat Apr 06, 2024 10:04 pmYou 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
Thanks to you, I can now display the value in the description!panraven wrote: ↑Sat Apr 06, 2024 11:31 pmCheck this 1st viewtopic.php?p=345558#p345558
Then the function can be :another example: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
The function does not change the 'Value' displayed (no return true, <changed_display>),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 ...
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 )
Thank you so much!
Who is online
Users browsing this forum: layzdevil