WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Inventory: Keep N amount while deleting X (https://www.wowinterface.com/forums/showthread.php?t=49200)

spartaniz 04-14-14 03:36 AM

Inventory: Keep N amount while deleting X
 
Hi guys

I do not know anyyything about programming so bare with me please.

I want a macro that will delete N amount of items IF i have a certain amount already.

Say I am farming copper veins and need 20 copper and 5 rough stone. I already have 5 roughstone but only 4 copper. I want a macro (if possible) to delete any extra roughstone automatically.

This:

/run for bag = 0,4,1 do for slot = 1, 32, 1 do local name = GetContainerItemLink(bag,slot); if name and string.find(name,2835) then PickupContainerItem(bag,slot); DeleteCursorItem(); end; end; end

deletes all the rough stone in my bags...

Any help? Anyone? please?

Phanx 04-14-14 05:10 AM

Not tested at all, but:
/run local i,n,t,k,q,_=2835,5 for b=0,4 do for s=1,32 do k=GetContainerItemLink(b,s) if k and k:find(":"..i.."%D") then t=GetItemCount(i) _,q=GetContainerItemInfo(b,s) if (t-q)>=n then PickupContainerItem(b,s) DeleteCursorItem() end end end end
Change the green number to the itemID of the item you want to process, and the purple number to the number you want to keep.

Note that "keep 5 Rough Stone" will actually keep up to 20, since Rough Stone stacks up to 20 and there's just not enough room in the macro to deal with stack splitting.


All times are GMT -6. The time now is 06:09 AM.

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