View Single Post
04/09/14, 06:16 PM   #12
beeradg
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 16
Originally Posted by Brack View Post
Neither of these functions (or variations) seem to exist.





Okay so CallSecureProtected("PickupInventoryItem", fromBag, fromSlot, quantity) works, as an item in my inventory is placed in my mouse cursor, however that isn't the desired outcome. I want items to be moved to the bank without player interaction (or at least not more than one button click).

I then tried CallSecureProtected("PlaceInInventory", fromBag, fromSlot) but this didn't seem to be able to move banked items into the inventory.

So it seems I'm still stuck. Are we even supposed to be able to use protected functions? I thought the purpose of those was to not allow modders access to those. Seems pretty silly that moving items around in a player's inventory/bank space would be protected anyway.


Edit: Actually I think I got it working... Here is my code that worked (for testing):
Code:
CallSecureProtected("PickupInventoryItem", 1, 1, 1)
BankFirstEmpty = FindFirstEmptySlotInBag(2)
CallSecureProtected("PlaceInInventory", 2, BankFirstEmpty)
Thanks to everyone again for the help.
Glad that worked. From the code in that link I posted: (had the answer all along)
Code:
function stackItem(fromBag, fromSlot, toBag, toSlot, quantity, name)
    local result = true
    -- just in case
    ClearCursor()
    -- must call secure protected (pickup the item via cursor)
    result = CallSecureProtected("PickupInventoryItem", fromBag, fromSlot, quantity)
    if (result) then
        -- must call secure protected (drop the item on the cursor)
        result = CallSecureProtected("PlaceInInventory", toBag, toSlot)
    end
    -- clear the cursor to avoid issues
    ClearCursor()
    return result
end
  Reply With Quote