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 


Writebytes setting the wrong value

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

Joined: 07 Jan 2017
Posts: 3

PostPosted: Sat Jan 07, 2017 3:52 pm    Post subject: Writebytes setting the wrong value Reply with quote

I'm trying to use this code

Code:
function convertToTable(convert)
   local str = string.sub(convert, string.find(convert, ": ")+2, string.len(convert))
   local t = {}

   for i = 1, #str do
      t[i] = str:sub(i, i)
   end
   return t
end


to convert a string into a table and then write that value to a byte address with this:

Code:
data = convertToTable(file:read())
writeBytes('[[BaseA]+10]+71E', data)


However, this just changes the address value to something different from the original number rather than writing it to the address.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Sat Jan 07, 2017 8:52 pm    Post subject: Reply with quote

What is stored in the file that you are trying to write?
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
CarCaddy
How do I cheat?
Reputation: 0

Joined: 07 Jan 2017
Posts: 3

PostPosted: Sun Jan 08, 2017 12:07 am    Post subject: Reply with quote

atom0s wrote:
What is stored in the file that you are trying to write?

Names of what is being edited along with the value like this:
Eye Size: 165

After trying some other things I got it to work with this:
Code:
data = file:read()
   data2 = string.sub(data, string.find(data, ": ")+2, string.len(data))
   writeBytes('[[BaseA]+10]+72d', tonumber(data2))
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sun Jan 08, 2017 12:59 am    Post subject: Reply with quote

You probably wanted writeInteger("address", value)
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