View previous topic :: View next topic |
Author |
Message |
S-nonymous027 How do I cheat? Reputation: 0
Joined: 25 Jul 2021 Posts: 9 Location: Earth
|
Posted: Sun Jul 25, 2021 7:44 am Post subject: getMemoryRecordByDescription no longer works for pointers |
|
|
First of all, here's the problematic code:
Code: | function read()
keywaveaddress = addresslist_getMemoryRecordByDescription(getAddressList(), 'Correct key presses (wave)')
errwaveaddress = addresslist_getMemoryRecordByDescription(getAddressList(), 'Typing errors (wave)')
keylvladdress = addresslist_getMemoryRecordByDescription(getAddressList(), 'Correct key presses (level)')
errlvladdress = addresslist_getMemoryRecordByDescription(getAddressList(), 'Typing errors (level)')
keywavestr = memoryrecord_getValue(keywaveaddress)
errwavestr = memoryrecord_getValue(errwaveaddress)
keylvlstr = memoryrecord_getValue(keylvladdress)
errlvlstr = memoryrecord_getValue(errlvladdress)
if keywavestr ~= "??" then
keywave = tonumber(keywavestr)
else
keywave = 0
end
if errwavestr ~= "??" then
errwave = tonumber(errwavestr)
else
errwave = 0
end
if keylvlstr ~= "??" then
keylvl = tonumber(keylvlstr)
else
keylvl = 0
end
if errlvlstr ~= "??" then
errlvl = tonumber(errlvlstr)
else
errlvl = 0
end
end
read()
print("Address:",keywaveaddress)
print("Value:",keywave)
|
It works fine if I input a plain address into it (it prioritizes normal addresses over pointers, shown in addressinput.png)
But as soon as I input a pointer instead, it threw an error (shown in pointererror.png)
When I checked the "keywaveaddress = addresslist_getMemoryRecordByDescription(getAddressList(), 'Correct key presses (wave)')" part I noticed that it outputs a blank address... (shown in blankaddress.png)
I've never encountered this kind of error when I used older Cheat Engine versions. Any idea why this is the case and is this a bug?
Description: |
Huh? Blank address when reading a pointer? |
|
Filesize: |
317.07 KB |
Viewed: |
1405 Time(s) |
|
Description: |
Error thrown when a pointer is inputted |
|
Filesize: |
330.96 KB |
Viewed: |
1405 Time(s) |
|
Description: |
Output obtained when a normal address is inputted |
|
Filesize: |
320.68 KB |
Viewed: |
1405 Time(s) |
|
|
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1053 Location: 0x90
|
Posted: Sun Jul 25, 2021 9:46 am Post subject: |
|
|
Quote: |
function read()
keywaveaddress = addresslist_getMemoryRecordByDescription(getAddressList(), 'Correct key presses (wave)')
errwaveaddress = addresslist_getMemoryRecordByDescription(getAddressList(), 'Typing errors (wave)')
keylvladdress = addresslist_getMemoryRecordByDescription(getAddressList(), 'Correct key presses (level)')
errlvladdress = addresslist_getMemoryRecordByDescription(getAddressList(), 'Typing errors (level)')
|
This is adding extra overhead, you can simplify it by doing this instead
Code: |
...
function read()
local al = getAddressList()
keywaveaddress = al.getMemoryRecordByDescription('Correct key presses (wave)')
errwaveaddress = al.getMemoryRecordByDescription('Typing errors (wave)')
keylvladdress = al.getMemoryRecordByDescription('Correct key presses (level)')
errlvladdress = al.getMemoryRecordByDescription('Typing errors (level)')
|
Then you can access the returned memory records like so
Code: |
-- CurrentAddress() - Returns an integer, but we're casting to string with the tostring function.
-- Can be used for simple addresses or pointers
keywavestr = tostring(keywaveaddress.CurrentAddress())
errwavestr = tostring(errwavestr.CurrentAddress())
keylvlstr = tostring(keylvlstr.CurrentAddress())
errlvlstr = tostring(errlvladdress.CurrentAddress())
if keywavestr ~= "??" then
keywave = tonumber(keywavestr)
else
keywave = 0
end
if errwavestr ~= "??" then
errwave = tonumber(errwavestr)
else
errwave = 0
end
if keylvlstr ~= "??" then
keylvl = tonumber(keylvlstr)
else
keylvl = 0
end
if errlvlstr ~= "??" then
errlvl = tonumber(errlvlstr)
else
errlvl = 0
end
print("KeyWaveAddress is: " .. keywavestr .. "\n" .. "ErrWaveAddress is : " .. errwavestr .. "\n" .. "KeyLvlAddress is : " .. keylvlstr .. "\n" "ErrLevelAddress is : " .. errlvlstr)
end
...
read()
|
I didn't test this but it should work fine.
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Sun Jul 25, 2021 12:35 pm Post subject: |
|
|
If you have recently changed the descriptions call
Code: |
AddressList.rebuildDescriptionCache()
|
also, this is shorter
Code: |
keywaveaddress = al['Correct key presses (wave)']
|
_________________
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 |
|
|
S-nonymous027 How do I cheat? Reputation: 0
Joined: 25 Jul 2021 Posts: 9 Location: Earth
|
Posted: Sun Jul 25, 2021 7:07 pm Post subject: |
|
|
Follow up: Using Darkbyte's method I managed to restore it and made it work again. Thanks for the help.
|
|
Back to top |
|
|
|