As part of a character modifier script I'm working on, I would like to backup a good chunk of memory (more than 1000 bytes) and save it to a file (essentially from address A to address B).
I would like to backup this chunk of memory to avoid the necessity of hard resetting the game when the char modifier is disabled, and to be able to restore the original memory structure. Do you guys know if this is possible?
I was trying using readBytes and writeBytes but with no success:
I admit I'm a bit weak in LUA so I apologise, this is what I came up with so far, while experimenting with 2 addresses, but it doesn't do anything, pretty sure my syntax is not correct:
{$lua}
--if syntaxcheck then return end
--local memrec = AddressList.getMemoryRecordByID(1337092678)
savedCloudUnitSOW = 0x0
savedCloudWeaponSOW = 0x0
function backup()
savedCloudUnitSOW = readBytes([[[unit_data_cloud]-2]],1412)
savedCloudWeaponSOW = readBytes([[[weapon_data_cloud]-2]],963)
end
function restore()
if savedCloudUnitSOW~=0x0 and savedCloudWeaponSOW~=0x0 then
writeBytes([[[unit_data_cloud]-2]],savedCloudUnitSOW)
writeBytes([[[weapon_data_cloud]-2]],savedCloudWeaponSOW)
end
end
[ENABLE]
backup()
[DISABLE]
restore()
Any LUA expert who can come to the rescue?