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 


Wrong table address

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

Joined: 08 Oct 2012
Posts: 577

PostPosted: Tue May 21, 2019 9:31 am    Post subject: Wrong table address Reply with quote

What is wrong with this bit of code. I get an different location than the table entry of DDC151A , returns 0B454290
Code:
local addresslist = getAddressList()
   maxmp1e = addresslist.getMemoryRecordByDescription("1st Max MP")
   print (maxmp1e)



2019-05-21_10-28-34.png
 Description:
 Filesize:  33.39 KB
 Viewed:  1366 Time(s)

2019-05-21_10-28-34.png


Back to top
View user's profile Send private message Yahoo Messenger
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Tue May 21, 2019 9:59 am    Post subject: Reply with quote

You're printing the memory record object itself. You need to set your variable to it's address, or print the MR's address.

https://wiki.cheatengine.org/index.php?title=Lua:Class:MemoryRecord

Code:
local addresslist = getAddressList()
maxmp1e = addresslist.getMemoryRecordByDescription("1st Max MP").Address
print (maxmp1e)


Code:
local addresslist = getAddressList()
maxmp1e = addresslist.getMemoryRecordByDescription("1st Max MP")
print (maxmp1e.Address)

_________________
Back to top
View user's profile Send private message Visit poster's website
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4289

PostPosted: Tue May 21, 2019 9:59 am    Post subject: Reply with quote

You're printing a userdata object.

This prints the address:
Code:
print(maxmp1e.Address)

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 577

PostPosted: Tue May 21, 2019 10:52 am    Post subject: Reply with quote

Ok to both and the address prints correctly, that brings up another question then I have set two var one for cur and this one for max set in the same manner. Later in the function, I have
Code:
   if curmp1e ~= maxmp1e then
      cur1e = max1e
   end
to set the cur to what ever the max is and it isn't working so would the correct way be something like this
Code:
max1e.address = addresslist.getMemoryRocordByDescription("1st Max MP")


if cur1e.value ~= max1e.value then
cur1e.value = max1e.value
?
Back to top
View user's profile Send private message Yahoo Messenger
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Tue May 21, 2019 1:57 pm    Post subject: Reply with quote

Yeah that should work, the main to keep in mind is that's a string comparison.
_________________
Back to top
View user's profile Send private message Visit poster's website
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