View previous topic :: View next topic |
Author |
Message |
CarCaddy How do I cheat? Reputation: 0
Joined: 07 Jan 2017 Posts: 3
|
Posted: Sat Jan 07, 2017 3:52 pm Post subject: Writebytes setting the wrong value |
|
|
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 |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8517 Location: 127.0.0.1
|
Posted: Sat Jan 07, 2017 8:52 pm Post subject: |
|
|
What is stored in the file that you are trying to write?
_________________
- Retired. |
|
Back to top |
|
|
CarCaddy How do I cheat? Reputation: 0
Joined: 07 Jan 2017 Posts: 3
|
Posted: Sun Jan 08, 2017 12:07 am Post subject: |
|
|
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 |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sun Jan 08, 2017 12:59 am Post subject: |
|
|
You probably wanted writeInteger("address", value)
|
|
Back to top |
|
|
|