-
Posted by Farside on Sun, 09 Aug 2009 20:23:59
I use this code to auto sell any grey quality items automaticly:
local frame = CreateFrame("Frame") frame:RegisterEvent("MERCHANT_SHOW") frame:SetScript("OnEvent", function() --sell trash local bag, slot, item for bag = 0, 4 do if GetContainerNumSlots(bag) > 0 then for slot = 1, GetContainerNumSlots(bag) do item = GetContainerItemLink(bag, slot) if item and select(3, GetItemInfo(item)) == 0 then --item is "poor" (gray) quality UseContainerItem(bag, slot) end end end end
I was wondering is there anyway to have it Print me a message and say something like "Vendor:Sold all grey items for "in here I would like the total money made selling the greys". (doesnt have to be each individual item sold but a total of all greys sold to vendor)
-
Posted by jnwhiteh on Sun, 09 Aug 2009 20:48:43
This might work:
local frame = CreateFrame("Frame") frame:RegisterEvent("MERCHANT_SHOW") frame:SetScript("OnEvent", function() --sell trash local totalValue = 0 for bag = 0, 4 do if GetContainerNumSlots(bag) > 0 then for slot = 1, GetContainerNumSlots(bag) do local item = GetContainerItemLink(bag, slot) if item and select(3, GetItemInfo(item)) == 0 then --item is "poor" (gray) quality UseContainerItem(bag, slot) local value = select(11, GetItemInfo(item)) totalValue = totalValue + value end end end print("Sold items to vendor for " .. totalValue) end)
-
Posted by Farside on Sun, 09 Aug 2009 22:07:48
I tried this code but when I sold a grey to vendor I got these messages:
Sold items to vendor for 0
Sold items to vendor for 12500
Sold items to vendor for 12500
Sold items to vendor for 12500
Sold items to vendor for 12500
If I sold one item or a stack of 3 gives same messages.
-
Posted by jnwhiteh on Sun, 09 Aug 2009 22:12:49
Then you'll need to do further calculation about how many items are in the stack, and how much you made from it. You might look at tekJunkSeller.. it does this and might have the code to get the amount sold, I'm not sure.
-
Posted by Farside on Sun, 09 Aug 2009 22:21:47
Your help is much appreciated, I looked at tekJunkSeller's code almost the same as what I'm using and it doesn't have any print message code. I'll post on more websites, and see what I can come up with.
Thank You
-
Posted by jnwhiteh on Sun, 09 Aug 2009 23:11:57
Well you can get all the information from here.. I just don't have the time to write the code for you.
GetContainerItemInfo can tell you how many items are in the stack you are selling.
GetItemInfo can tell you how much each individual item in the stack will sell for.
The two of those and simple math/programming can get you what you desire.