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 


How do you change the type of a memory record? Solved By Me

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
AmyGrrl
!BEWARE! Deletes post on answer
Reputation: 0

Joined: 15 Dec 2016
Posts: 17

PostPosted: Mon Dec 02, 2019 1:09 pm    Post subject: How do you change the type of a memory record? Solved By Me Reply with quote

I'm not sure I am even asking the right question. I wrote a script to check for the version of the program. I have two things in my list.

Version Check set to String[1]
Version Check Hex set to Array of bytes [1]

This work perfectly so for. It does an AOBScan and will always returns only one results. Then offsets the found address by 10 to get the start of the version number. Then counts how long the version number is and stops when it reaches the end. Then it sets the Version Check to the found address. What I don't know how to do is set the String length to count I did so that it changes from String[1] to String [8] for example. Thanks for any help.

Code:
VersionCheckValue=getAddressList().getMemoryRecordByDescription("Version Check")
VersionCheckHexValue=getAddressList().getMemoryRecordByDescription("Version Check Hex")
BedrockServerAOBScan = AOBScan("5D 20 56 65 72 73 69 6F 6E", "-X+W")
memoryrecord_setAddress(VersionCheckHexValue, string.format('%X', tonumber(BedrockServerAOBScan[0], 16) + 10))
VersionCheckCount = 0
while true do
  if tostring(VersionCheckHexValue.Value) ~= "0A" then
    memoryrecord_setAddress(VersionCheckHexValue, string.format('%X', memoryrecord_getAddress(VersionCheckHexValue) + 1))
    VersionCheckCount = VersionCheckCount + 1
   elseif tostring(VersionCheckHexValue.Value) == "0A" then
    memoryrecord_setAddress(VersionCheckValue, string.format('%X', tonumber(BedrockServerAOBScan[0], 16) + 10))
    break
  else
  end
end


Found what I was looking for. This fixed the problem.

Code:
VersionCheckValue.String.Size = VersionCheckCount


I also redid the code a little to make run faster.

Code:
VersionCheckValue=getAddressList().getMemoryRecordByDescription("Version Check")
VersionCheckHexValue=getAddressList().getMemoryRecordByDescription("Version Check Hex")
memoryrecord_setAddress(VersionCheckValue, string.format('%X', tonumber(AOBScan("5D 20 56 65 72 73 69 6F 6E", "-X+W")[0], 16) + 10))
memoryrecord_setAddress(VersionCheckHexValue, VersionCheckValue.Address)
VersionCheckCount = 0
while true do
  if tostring(VersionCheckHexValue.Value) ~= "0A" then
    memoryrecord_setAddress(VersionCheckHexValue, string.format('%X', memoryrecord_getAddress(VersionCheckHexValue) + 1))
    VersionCheckCount = VersionCheckCount + 1
   elseif tostring(VersionCheckHexValue.Value) == "0A" then
    VersionCheckValue.String.Size = VersionCheckCount
    break
  else
  end
end
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