View previous topic :: View next topic |
Author |
Message |
The Sage Of Time How do I cheat? Reputation: 0
Joined: 30 May 2005 Posts: 6
|
Posted: Tue Jan 13, 2015 9:44 pm Post subject: Small problem with writeRegionToFile() .. |
|
|
So I'm attempting to write a memory region to a file like so:
Code: | writeRegionToFile(getCheatEngineDir()..'data\\file.bin','["process.exe"+04D5B7F8]+40',4072) |
This works perfectly, except that it only works once. For some reason it appears as though the Cheat Engine process locks the file after it writes it, making it so that the file can neither be overwritten or deleted until the cheat engine process is closed.. This wouldn't be an issue except that I kind of want to be able to overwrite the file at certain times (namely when the memory region has changed and the original contents of the file become obsolete.)
I realize I could write multiple files, but eventually with what I'm doing that would become really cluttered and fill my work directory with a lot of useless and\or redundant data..
So yeah, is there a quick and easy way to force Cheat Engine to release the file so that it can be overwritten?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Wed Jan 14, 2015 4:48 am Post subject: |
|
|
no real fix, but you could try readBytes using the table method, then convert it into a string and then use the io library of lua to write that to a disk
_________________
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 |
|
|
The Sage Of Time How do I cheat? Reputation: 0
Joined: 30 May 2005 Posts: 6
|
Posted: Thu Jan 15, 2015 5:54 am Post subject: |
|
|
I feel kind of dumb for asking, but I'm kind of new to Lua. How would one convert a table object into a string?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Thu Jan 15, 2015 6:09 am Post subject: |
|
|
you can use byteTableToString
Code: |
a={}
a[1]=72
a[2]=101
a[3]=108
a[4]=108
a[5]=111
--or
--a=readBytes(address, 4072, true)
s=byteTableToString(a)
--or if you like to use pure lua:
--s=''
--for i=1,#a do
-- s=s..string.char(a[i])
--end
print(s)
|
_________________
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 |
|
|
The Sage Of Time How do I cheat? Reputation: 0
Joined: 30 May 2005 Posts: 6
|
Posted: Thu Jan 15, 2015 6:14 am Post subject: |
|
|
Ah, snazzy! That's quite handy!
Yes this suits my needs perfectly then, thank you for your help!
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Thu Jan 15, 2015 6:18 am Post subject: |
|
|
and to write to disk:
Code: |
f=io.open(getCheatEngineDir()..'data\\file.bin',"wb")
f:write(s)
f:close()
|
_________________
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 |
|
|
|