 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
[email protected] Cheater
Reputation: 0
Joined: 15 Jul 2019 Posts: 40
|
Posted: Fri Mar 24, 2023 6:46 pm Post subject: writeString |
|
|
Code: | local playerName = readString(addr,256,true) --isWideString
--playerName = 'abcdefg'
writeString(addr,'xyz',true)
--playerName = 'xyzdefg'
--Why not "xyz". What should I do?
|
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 121
Joined: 06 Jul 2014 Posts: 3790
|
Posted: Fri Mar 24, 2023 7:30 pm Post subject: |
|
|
CE doesn't write a null terminator.
Code: | function writeStringZero(address, str, wide)
local t
if wide then
t = wideStringToByteTable(s)
t[#t+1] = 0
t[#t+1] = 0
else
t = stringToByteTable(s)
t[#t+1] = 0
end
return writeBytes(address, t)
end
-- example:
writeStringZero(addr,'xyz',true) |
It would be really nice if CE accounted for embedded 0 bytes, but it doesn't.
Code: | -- CE 7.5: doesn't work: only writes 'abc'
writeString(addr, 'abc\0') | Maybe this could be called a bug since embedded 0 bytes work fine in Lua?
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 26
Joined: 16 Feb 2017 Posts: 1061
|
Posted: Fri Mar 24, 2023 7:58 pm Post subject: |
|
|
Just an observation ...
Code: | function stringToAob(addr,byt)
local searchTable = {}
search2 = readString(addr,16,true)
print("search2: "..search2)
for i=1,byt do
searchTable[i]=string.format('%X',search2:byte(i))
end
local searchHexString = table.concat(searchTable," ")
return searchHexString
end
print(stringToAob("023AA8BA",6)) -- "abcdef" = "61 62 63 64 65 66"
writeString("023AA8BA",'xyz ')
print(stringToAob("023AAAEA",6)) --"zxy " = "78 79 7A 20 20 20"
writeString("023AA8BA",'xyz',true) --"z.x.y." = 78 00 79 00 7A 00 |
_________________
|
|
Back to top |
|
 |
[email protected] Cheater
Reputation: 0
Joined: 15 Jul 2019 Posts: 40
|
Posted: Sat Apr 01, 2023 10:39 pm Post subject: |
|
|
yes, is working.thanks.
|
|
Back to top |
|
 |
|
|
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
|
|