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 


getAddress doesn't return offsets?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
SleepiDreamer
Cheater
Reputation: 0

Joined: 27 Aug 2021
Posts: 41

PostPosted: Mon Nov 01, 2021 1:49 am    Post subject: getAddress doesn't return offsets? Reply with quote

I have this code where I try to find the address of an item in my AddressList "Sun Azimuth":
Code:
for i = 1, 47, 1 do --How do I get the length of my AddressList?
    if(getAddressList()[i].getDescription() == "Sun Azimuth") then
        local base = getAddressList()[i]
        print(getAddressList()[i].getAddress())
    end
end

While the documentation says this will return the pointer with all of its offsets, I only get:
Code:
"Minecraft.Windows.exe"+04169158 

The original Pointer is [[[["Minecraft.Windows.exe"+04169158]+40]+A0]+C0]+DC
What am I doing wrong here?
Is there a better way of achieving the same thing?

_________________
Hope you're having a great day!
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1053
Location: 0x90

PostPosted: Mon Nov 01, 2021 4:29 am    Post subject: Reply with quote

Length of the address is:
Code:

addresslist.Count


It's easier to think of each entry as an object that contains properties, so you'll want to retrieve the object and then have access to its properties like so:
Code:

function getMemRec(desc)
  local al = getAddressList()
  local mr = al.getMemoryRecordByDescription(desc)
  if mr ~= nil then
     return mr
  end
end

local myAddress = getMemRec('address description')

for i=0, myAddress.OffsetCount -1 do
    -- For recognition purposes, format the offset in hexadecimal
    print(string.format("%X", myAddress.Offset[i]))
end


Whilst this doesn't print it in this format
Code:

[[[["Minecraft.Windows.exe"+04169158]+40]+A0]+C0]+DC


It gives you insight on how you can access each memory record's offsets.
Back to top
View user's profile Send private message
SleepiDreamer
Cheater
Reputation: 0

Joined: 27 Aug 2021
Posts: 41

PostPosted: Mon Nov 01, 2021 6:06 am    Post subject: Reply with quote

Thanks for the response, after some tweaking it worked!
_________________
Hope you're having a great day!
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1053
Location: 0x90

PostPosted: Mon Nov 01, 2021 7:33 am    Post subject: This post has 1 review(s) Reply with quote

SleepiDreamer wrote:
Thanks for the response, after some tweaking it worked!


You're welcome Smile. If I helped in any way please click the thumbs-up next to reputation to show your appreciation.
Back to top
View user's profile Send private message
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