Searching bags for item(s)
What I am trying to do here is loop thru my bags to find items that match an item id. FaithfulDeleteList is a saved variable table of ids that are previously added, but it never reaches the line that should print "is this thing on?" I can't seem to find where I am going wrong?
Code:
if event == "ITEM_PUSH" then |
Not all your bags have 32 slots in them. Your main backpack certainly doesn't. You should get the bag size first.
|
Quote:
Code:
if event == "ITEM_PUSH" then |
ITEM_PUSH just lets the UI know to do the animation of the item going into a bag. BAG_UPDATE is when the item has actually made it into the bag.
|
It making it to be bag is not of much concern, where as the inventory still needs to be scanned to check if itemid from saved table is in the bags to begin with if that makes sense, though I have implemented the BAG_UPDATE event you mentioned, still not working as intended.
Edit: Would it make better sense to start from the table. Get first id in table, scan each bag slot for the id, or like I'm trying to have it do now is slot 1 scan all ids, next slot scan all ids etc. I hope this makes sense. |
Drycoded (copy and pasted from one of my addons) because I cant log into wow to test it atm ...
Lua Code:
|
Is there a reason your FaithfulDeleteList is an array and not a dictionary? Changing the way you store the info could cut out a lot of needless iterating.
|
Quote:
Code:
|
You are saving the itemID as a string and not a number so it will never match in your loop. This is why you should always post your entire code. When I get off work I'll post how to do it with a dictionary instead if someone hasn't already.
|
I've updated the code above.
|
Here is a version that throttles the amount of processing:
Code:
local FaithfulDeleteList = { |
Wouldn't it be better to fire on BAG_UPDATE_DELAYED instead?
|
All times are GMT -6. The time now is 03:36 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI