How to lock an item?
I've been trying different calls and options for hours, and I only got as far as this:
Code:
PLAYER_INVENTORY:RefreshInventorySlotLocked(1, slotId, lock, bagId) All values checked valid. It only fades out the item and toggles the .locked property, but doesn't do the rest of what happens when locking an item. Is there just a simple call to lock/unlock items? I couldn't find it. I found this: http://esodata.uesp.net/100022/src/i....lua.html#2694 http://esodata.uesp.net/100022/src/i....lua.html#1595 |
Quote:
|
So your goal is to lock the item? I haven't tested this, but is this what you want?
lua Code:
|
Quote:
|
Quote:
That was what I was looking for - although bag and slot are reversed, should be: Code:
local bag, index = bagId, slotId And the above works! BUT with that I saw the code calls to: http://esodata.uesp.net/100015/src/i....lua.html#1179 SO, I would like to implement the original call into mine: http://esodata.uesp.net/100022/src/i....lua.html#1630 I mimicked it for myself, but I get an unexpected error about: Code:
Checking type on argument slotIndex failed in IsSlotLocked_lua Code:
local inventorySlot = slotControl |
In order to find the error please post the whole code and not the snippet here only.
It seems that your index variable is NIL somehow. Btw: Why do you copy the bag and slot to new vars? local bag, index = bagId, slotId -- ZO_Inventory_GetBagAndIndex(inventorySlot) Just use bagId and slotId if they are defined via ZO_Inventory_GetBagAndIndex(inventorySlot) before. |
Quote:
Please note that I said above that Dolgubon's code (with fixes) works fine. My interest is in mimicking the game code, rather than overriding their way of locking items. |
I don't get what you are trying then sorry.
Do you want to know where the inventory row's data.slotType is created? If this is all relevant code where is the "slotIndex" in that code which the lua error messages tells you the type is wrong? Quote:
|
Quote:
Code:
IsSlotLocked(inventorySlot) https://esoapi.uesp.net/current/src/...t.lua.html#463 The error isn't in my code, it's in that game function that should be working fine. After all, with the same bagID and slotID values, I can do CanItemBePlayerLocked() and SetItemIsPlayerLocked() just fine in the bypass code suggested. EDIT: I just realized my function toggles locking, so I don't even need to run their IsSlotLocked() check. I took it out. I also realized I can just access the same .locked data from the data object I already have. However, I then ran into the IsItemAlreadySlottedToCraft() check they run. It's a local, so I can't even use it. And the actions object actionHandlers[] is local too, so no access either. I'm left with locking it myself, rather than using the game functions for it. *smh* Unless somebody knows how to access IsItemAlreadySlottedToCraft()? |
I don't really know what you're trying to do with it, but you need to call it on the specific station you're attempting to check it against. Alchemy, Enchanting, or "Smithing" (woodworking, blacksmithing and clothier should fall under this, Jewelry probably will too?).
|
Quote:
|
Sorry, I didn't specify properly: I was talking about IsItemAlreadySlottedToCraft()
|
Quote:
|
If you want to use the funciton but it is local, just copy&paste it to your code?
Lua Code:
|
Quote:
No way. Then it can break at any update. The whole purpose of me asking for this is to stick to game code, so I don't need to worry about game dev changes to this mechanism. |
As the function is local you cannot access it. If it changes you need to adopt it in your code.
Or find another solution like getting the control names of the slots and check if the slot is filed within your addon (which might brake as well as they decide to change control names or function names or whatever). There is no "safe way". |
Quote:
That is exactly the answer I have not been looking for, as I've repeatedly said. It makes no sense that I can't implement Locking into my addon the same way the game does, and if that's the case, then I should report it to the dev' team. |
All times are GMT -6. The time now is 01:34 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI