[Solved] Dying Light Backpack Editor Error
Posted: Sat Dec 30, 2017 5:00 pm
Hello all. I am wondering if anyone might be able to offer me some insight to help address a Lua script error I've been getting intermittently with the Dying Light cheat table (thread link here). The error is appearing from the script used for the Backpack Editor. I decided to bring this up here because I haven't found anyone mention running into this same error, so I am presently assuming that I may need address it for myself.
Anyway, I get the following error on what seems like a random basis:
This is the function from the Lua script that includes line 28:
So from this I can gather that, at line 28, it's looking for some string value that includes "Craftplan_" and spitting out an error when it cannot locate it. Part of what's got me stuck is that it sometimes will find it and work fine and then at other times it won't and give me the error from line 28.
For context, the value for "ItemEditData" is provided from the Auto Assemble script that is run to enable the Backpack Editor Lua script. On a related note, the Auto Assemble script appears to work correctly. It successfully locates the array of bytes and gets activated. In addition, even when I do get the error, I still get some partial functionality from the Backpack Editor. It is able to find and read my inventory. That's the other part of what's got me stuck.
Tracing back from line 28, it is looking for a string value at "ItemString." ItemString is found from ItemAddr, which is found from BaseItemPoint, which is ultimately found from ItemEditData. From a novice's perspective, it looks like the address where we are hoping to find a string value on line 28 is not always the right one; the string value will sometimes not be there.
So my ultimate question is how might I best try to tackle this? How can I find out where the address I want to locate has gone when it isn't where the script expected it to be? And if it can move, can I deal with that through the Lua script? I've been reluctant to change too much since it does locate the inventory, but I don't know if I'd have to basically start over with it to make sure it worked for me consistently.
Anyway, I get the following error on what seems like a random basis:
Code: Select all
Error:[string "ItemTable = {}..."]:28: bad argument #1 to 'find' (string expected, got nil)
Code: Select all
17 function BackPackUpdate()
18 WeapPack = readQword(readQword("ItemEditData")+0x60)+0x40
19 ItemPack = readQword(readQword("ItemEditData")+0x58)+0x40
20 BaseItemPoint = readQword("ItemEditData+8")-0x18
21 local BasePointCount = readInteger(BaseItemPoint+8)
22 PackEdit_LBWeapSwap.clear()
23 local WeapSwapList = PackEdit_LBWeapSwap.getItems()
24 local ItemSwapList = PackEdit_LBItemSwap.getItems()
25 for i=0,BasePointCount-1 do
26 local ItemAddr = readQword(readQword(BaseItemPoint)+i*8)
27 local ItemString = readString(readQword(ItemAddr+0x18))
28 if string.find(ItemString,"Craftplan_") then
29 table.insert(ModTable,{Address = ItemAddr,Name = ItemString})
30 end
31 table.insert(BaseItemTable,{Address=ItemAddr,Name=ItemString})
32 end
33 PackEdit_CBWeapMod.clear()
34 local ModList = PackEdit_CBWeapMod.getItems()
35 ModList.add("None")
36 PackEdit_CBWeapMod.setItemIndex(0)
37 for k,v in pairs(ModTable) do
38 ModList.add(v.Name)
39 end
40 for k,v in pairs(BaseItemTable) do
41 WeapSwapList.add(v.Name)
42 ItemSwapList.add(v.Name)
43 end
44 end
For context, the value for "ItemEditData" is provided from the Auto Assemble script that is run to enable the Backpack Editor Lua script. On a related note, the Auto Assemble script appears to work correctly. It successfully locates the array of bytes and gets activated. In addition, even when I do get the error, I still get some partial functionality from the Backpack Editor. It is able to find and read my inventory. That's the other part of what's got me stuck.
Tracing back from line 28, it is looking for a string value at "ItemString." ItemString is found from ItemAddr, which is found from BaseItemPoint, which is ultimately found from ItemEditData. From a novice's perspective, it looks like the address where we are hoping to find a string value on line 28 is not always the right one; the string value will sometimes not be there.
So my ultimate question is how might I best try to tackle this? How can I find out where the address I want to locate has gone when it isn't where the script expected it to be? And if it can move, can I deal with that through the Lua script? I've been reluctant to change too much since it does locate the inventory, but I don't know if I'd have to basically start over with it to make sure it worked for me consistently.