getting bagslots from the tooltip
Unless there is a function where I can get the total number of slots in a bag that is in my inventory (not equipped)
My guess is that I have to scan the tooltip, but I have no idea how to do that I know that Code:
CONTAINER_SLOTS = "%d Slot %s"; but not how to get %d as a value from that line in the tooltip I would appreciate a sample code |
I couldn't see anything specific, so hopefully someone better versed in this area will pipe in at some point, but this might be one way of getting the info you need.
Get the item in the tooltip https://wow.gamepedia.com/API_GameTooltip_GetItem Use the item link return value https://wow.gamepedia.com/ItemLink Then see what the different values are in the itemString relating to the item https://wow.gamepedia.com/ItemString Hopefully one of those values will be the bag quantity, trial and error will obviously be the key |
Lua Code:
|
I might get some of the info i need from getItemString
-- Yes d87 i was thinking of a function like this but for bagslots and not Ilvl but i have no idea what the gsub is suppose to look like |
local pattern = "^" .. CONTAINER_SLOTS:gsub("%%d", "(%%d+)"):gsub("%%s", ".+")
|
I can't test this yet, but can you please eli5 what this means?
From what i have read %d is number, %s is string but why use %%d? |
Quote:
Check this out |
Thank you!
Got it working!
Guess I have to read up on stringformating and those stuffs now :p |
Congratulations ... because Grats isn't long enough
|
Quote:
|
Congrats! Always awesome when a plan comes together. ;) :banana:
|
Before printing you might want to sort the suggestions in, for example, descending benefit.
How should your addon treat profession bags? What about bags that are in (or for) bank? |
thank you all!
I really appreciate suggestions :) This is only meant for personal use now. The addon tells me if I have gotten any better gear, a bigger bag or new transmog gear As of now it only check the 0-4 slots of the inventory, and only for the subtype "Bag" But I might add this in if/after a public release I have no idea how the addon will work with other languages than English either |
All times are GMT -6. The time now is 09:32 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI