Thread Tools Display Modes
02/11/17, 03:44 PM   #1
Heppy
AddOn Author - Click to view addons
Join Date: Jan 2017
Posts: 8
Loop through crafting bag

Hey, i've been trying to figure out how to loop through items in crafting bag yet I haven't found a way.
Is there some function similar to let's say for instance "GetItemName" but that gathers from Crafting Bag? Or is there some kind of bagId that is Crafting bag? Can only find these as bagId: http://wiki.esoui.com/Globals#Bag

Regards, Heppy.
  Reply With Quote
02/11/17, 03:59 PM   #2
Rhyono
AddOn Author - Click to view addons
Join Date: Sep 2016
Posts: 659
This will loop through the craft bag and spit out every item's item link. Obviously if you want do something else with the data, change the d() line.
lua Code:
  1. for index, data in pairs(SHARED_INVENTORY.bagCache[BAG_VIRTUAL])do
  2.     if data ~= nil then
  3.         d(GetItemLink(BAG_VIRTUAL,data.slotIndex))
  4.     end
  5. end
  Reply With Quote
02/11/17, 05:57 PM   #3
Heppy
AddOn Author - Click to view addons
Join Date: Jan 2017
Posts: 8
Originally Posted by Rhyono View Post
This will loop through the craft bag and spit out every item's item link. Obviously if you want do something else with the data, change the d() line.
lua Code:
  1. for index, data in pairs(SHARED_INVENTORY.bagCache[BAG_VIRTUAL])do
  2.     if data ~= nil then
  3.         d(GetItemLink(BAG_VIRTUAL,data.slotIndex))
  4.     end
  5. end
Thank you!
I was wondering if it had something to do with the BAG_VIRTUAL.
That's exactly what I need! Thanks
  Reply With Quote
02/11/17, 06:13 PM   #4
Dolgubon
 
Dolgubon's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2016
Posts: 408
While that does loop you through the crafting bag, there's some underlying structure you can exploit. In the craft bag, the slotId is the itemId. So if you already know what you need to find, you can just use that.
  Reply With Quote
02/12/17, 04:21 AM   #5
Heppy
AddOn Author - Click to view addons
Join Date: Jan 2017
Posts: 8
Originally Posted by Dolgubon View Post
While that does loop you through the crafting bag, there's some underlying structure you can exploit. In the craft bag, the slotId is the itemId. So if you already know what you need to find, you can just use that.
I'm not after a specific item, I'm after all the items so
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Loop through crafting bag

Thread Tools
Display Modes

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