Thread Tools Display Modes
11-22-22, 12:26 AM   #1
pasiv
A Murloc Raider
Join Date: Jul 2019
Posts: 7
Question Help with understanding PutItemInBag(23)

I'm new to lua, and I'm trying to make a tiny addon for myself that will help me manage my inventory. I'm currently trying to move items from inventory to a free bag slot, but in my testing, it seems that "PutItemInBag(23)" is not functioning at all as I had expected. "PutItemInBackpack()" works perfectly fine. So what am I missing here?

Code:
PickupInventoryItem(GetInventorySlotInfo("HEADSLOT"))
if CursorHasItem() then
   --PutItemInBackpack() -- Works fine.
   PutItemInBag(23) --! Doesn't work on beta or live, but works in wrath.
end
Forgive my noobishness, I'm super green.
  Reply With Quote
11-22-22, 02:21 AM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,323
One thing to keep in mind, bag slots count up from right to left. This means 23 is the far left bag while 20 is the bag next to the backpack. Note the new reagent bag in Dragon Flight occupies slot 24.

If you attempt to put an item into a full bag or one that doesn't exist, the action will silently fail. (Doesn't throw an error, but does nothing either)
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 11-22-22 at 02:24 AM.
  Reply With Quote
11-22-22, 06:24 AM   #3
pasiv
A Murloc Raider
Join Date: Jul 2019
Posts: 7
True, but no matter which slotid I use (20,21,22, or 23), empty or has free slots, that code just won't deposit the item.
  Reply With Quote
11-22-22, 09:01 AM   #4
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
This is a sneaky change. The specific IDs for this specific function now start at 31 instead of 20. The first bag next to the backpack is 1 + CONTAINER_BAG_OFFSET, next one to the left of that is 2 +, and so on.

https://github.com/Ketho/wow-ui-sour...NER_BAG_OFFSET

Last edited by Kanegasi : 11-22-22 at 09:03 AM.
  Reply With Quote
11-22-22, 04:19 PM   #5
pasiv
A Murloc Raider
Join Date: Jul 2019
Posts: 7
Oh wow you solved the issue! Thanks! I saw that code and had no clue what was happening with it lol. I was relying on the wowpedia page which didn't make any reference to this.

Thanks!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Help with understanding PutItemInBag(23)


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off