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 


MemoryRecord.Value only affects the entry value visually?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
phoenix4231
How do I cheat?
Reputation: 0

Joined: 19 Sep 2021
Posts: 4

PostPosted: Sun Sep 19, 2021 2:47 pm    Post subject: MemoryRecord.Value only affects the entry value visually? Reply with quote

Hello. I've been trying to make a teleportation script/trainer. I have pointers for the x/y/z coordinates on my table, which look like this: imgur. com/a/3IV1dzF

And then here is the script for "Home":
Code:

{$lua}
if syntaxcheck then return end
[ENABLE]

getAddressList().getMemoryRecordByDescription("X").Value = 2736
getAddressList().getMemoryRecordByDescription("Y").Value = 1861
getAddressList().getMemoryRecordByDescription("Z").Value = 242

[DISABLE]


When I toggle my "Home" script, the values in the table successfully change to the values I provided, however it seems to only be a visual change. My character does not teleport and the X/Y/Z values go back to their previous values when I move my character.

Changing the X/Y/Z values manually in the table and writeFloat('address', value) both worked, so I'm not sure why .Value does not seem to work.

I'm thinking it might be related to X/Y/Z being Float types, or .Value is only a string representation and not the actual value? In either case, what might be the problem, and is there another way to solve this?

I'm trying to change my previous writeFloat solution because I have to manually change all of the address strings per location if I need to update the pointer. The whole thing is actually quite crude since it's the only solution I understand how to do, but if there's another way to do teleportation I would appreciate it.

Thank you! :)
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

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

PostPosted: Mon Sep 20, 2021 1:54 am    Post subject: Reply with quote

Try this:
Code:

function setMemValue(description, value)
         local al = getAddressList()
         local mr = al.getMemoryRecordByDescription(tostring(description))
         if mr ~= nil then
            mr.value = tonumber(value)
         end
end


Use it like this:
Code:

setMemValue('No description', 50)


The first parameter is the description of the table entry you want to change and the second parameter is the value you want to change it to.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25252
Location: The netherlands

PostPosted: Mon Sep 20, 2021 3:38 am    Post subject: Reply with quote

Did you recently rename the descriptions? Sometimes you have to rebuild the name cache after a rename if there's an overlap in names
_________________
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
View user's profile Send private message MSN Messenger
phoenix4231
How do I cheat?
Reputation: 0

Joined: 19 Sep 2021
Posts: 4

PostPosted: Mon Sep 20, 2021 9:22 am    Post subject: Reply with quote

LeFiXER wrote:
Try this:
Code:

function setMemValue(description, value)
         local al = getAddressList()
         local mr = al.getMemoryRecordByDescription(tostring(description))
         if mr ~= nil then
            mr.value = tonumber(value)
         end
end


Use it like this:
Code:

setMemValue('No description', 50)


The first parameter is the description of the table entry you want to change and the second parameter is the value you want to change it to.


Ah, it looks like it did the same. ;; It edits the value that I see on the table but it doesn't persist. Sad

Dark Byte wrote:
Did you recently rename the descriptions? Sometimes you have to rebuild the name cache after a rename if there's an overlap in names

Oh, I actually did! I replaced the previous X/Y/Z pointers very recently. How do I rebuild the name cache? Surprised
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

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

PostPosted: Mon Sep 20, 2021 10:11 am    Post subject: Reply with quote

Just call:
Code:

 AddressList.rebuildDescriptionCache()
Back to top
View user's profile Send private message
phoenix4231
How do I cheat?
Reputation: 0

Joined: 19 Sep 2021
Posts: 4

PostPosted: Mon Sep 20, 2021 11:07 pm    Post subject: Reply with quote

LeFiXER wrote:
Just call:
Code:

 AddressList.rebuildDescriptionCache()

Oh, sadly this did not do the trick either. Still does the same. :(

However, I did (belatedly) realize I could simply set up a function for setting coordinates in the CT lua script instead of putting it in the individual scripts. (I did not know the auto assemble scripts could call a function from the CT lua script until now, my bad)

I still think the MemoryRecord.Value solution would have been better if I could make it work, though it looks like it really doesn't want to work... :(
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25252
Location: The netherlands

PostPosted: Tue Sep 21, 2021 12:13 am    Post subject: Reply with quote

So the the value stays the value in CE, until you change the character position ingame and then it changes back?

That sounds like the memoryrecord has the wrong address or you're changing it at the wrong time

You can try setting the .Active property to true before changing the value

_________________
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
View user's profile Send private message MSN Messenger
phoenix4231
How do I cheat?
Reputation: 0

Joined: 19 Sep 2021
Posts: 4

PostPosted: Tue Sep 21, 2021 6:06 am    Post subject: Reply with quote

Dark Byte wrote:
So the the value stays the value in CE, until you change the character position ingame and then it changes back?

That sounds like the memoryrecord has the wrong address or you're changing it at the wrong time

You can try setting the .Active property to true before changing the value


OH. Yup, that's what happened. It turned out the pointer in the table was not updated correctly after I restarted, and the address on my writeFloat was a different one and that's why that one still worked. Changed the pointer to the same one and .Value worked with rebuildDescriptionCache.

Thanks! :)
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