Originally Posted by Rhyono
So your goal is to lock the item? I haven't tested this, but is this what you want?
lua Code:
if CanItemBePlayerLocked(slotId,bagId) then SetItemIsPlayerLocked(slotId,bagId,true) else d("Item cannot be locked.") end
|
That was what I was looking for - although bag and slot are reversed, should be:
Code:
local bag, index = bagId, slotId
local locking = not IsItemPlayerLocked(bag, index) -- The locking state to apply.
if CanItemBePlayerLocked(bag, index) then
SetItemIsPlayerLocked(bag, index, locking)
end
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
stack traceback:
[C]: in function 'IsSlotLocked'
My code just copies from original and all values check out, but I can't find a .slotType anywhere, in control, nowhere. Thus my code:
Code:
local inventorySlot = slotControl
local bag, index = bagId, slotId -- ZO_Inventory_GetBagAndIndex(inventorySlot)
local locking = not IsItemPlayerLocked(bag, index) -- The locking state to apply.
local action
if locking then
action = SI_ITEM_ACTION_MARK_AS_LOCKED
-- Can't lock these.
if IsItemAlreadySlottedToCraft(inventorySlot) then return end
else
action = SI_ITEM_ACTION_UNMARK_AS_LOCKED
end
if not IsSlotLocked(inventorySlot) and CanItemBePlayerLocked(bag, index) and
not QUICKSLOT_WINDOW:AreQuickSlotsShowing() then
slotActions:AddSlotAction(action,
function() MarkAsPlayerLockedHelper(bag, index, locking) end,
"secondary")
end