ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Loop through crafting bag (https://www.esoui.com/forums/showthread.php?t=6814)

Heppy 02/11/17 03:44 PM

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.

Rhyono 02/11/17 03:59 PM

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

Heppy 02/11/17 05:57 PM

Quote:

Originally Posted by Rhyono (Post 29812)
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 :D

Dolgubon 02/11/17 06:13 PM

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.

Heppy 02/12/17 04:21 AM

Quote:

Originally Posted by Dolgubon (Post 29820)
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 :)


All times are GMT -6. The time now is 07:24 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI