Recently I was learning how to make some automated code to simplify modifications.
And I was able to figure out how to do AOB Scan, etc, etc.
But there is one question: I was not able to add those already-found addresses into the main GUI's memory records properly.
Here's my script.
Code: Select all
{$lua}
if syntaxcheck then return end
local addrLst = getAddressList()
[ENABLE]
scan = AOBScan("D4 C2 D9 A2 BF 46 BA 71 DE 18 A1 BE F7 9B AE B1")
resultTotal = scan.Count
registerSymbol("TotalResults", resultTotal)
for i=1, resultTotal, 1 do
local base = scan[i-1]
local ptr = '['..base..']+56';
registerSymbol("InvItem"..tostring(i), ptr)
local address = getAddress(ptr)
local description = "Inventory "..tostring(i).." Item Count"
local mr = addrLst.createMemoryRecord()
mr.Description = description
mr.Address = ptr -- This address is not added properly in the memory record.
mr.Type = vtDword
parentMR = addrLst.getMemoryRecordByDescription('Inventory Edit')
if parentMR~=nil then mr.appendToEntry(parentMR) end
end
scan.destroy()
[DISABLE]
for i=1, resultTotal, 1 do
unregisterSymbol("InvItem"..tostring(i))
local description = "Inv " .. tostring(i) .. " Item Count"
local recordsToDelete = {}
local mr = addrLst.getMemoryRecordByDescription(description) -- How to delete those ones? This does not work. It says mr is nil.
mr.free()
end
resultTotal = nil
unregisterSymbol("resultTotal")
Also, the next commented line "How to delete those ones? This does not work." is another problem: I can't remove those items from the address list. What's the proper way to do this?