hi everyone im looking for the script line that will able my addon to auto-buy reagent for my charac(a mage) when talking to a reagent vendor...
if anyone can tell me how to write it...
thx a lot|||Yeah some autobuy for candles for my priest would be very nice, havent found an addon that does this tho.|||Quote:
Yeah some autobuy for candles for my priest would be very nice, havent found an addon that does this tho.
Hmm, kind of complicated guys... it takes 3 parts: part 1 is it a reagent vendor? part 2 which reagents? part 3 are you missing reagents?
local IsReagentVendor = false
local IsRepairVendor = CanMerchantRepair()
local NeedReagents = false
if GetItemCount(L["Arcane Powder"]) < addon.db.profile.RestockPowder or
GetItemCount(L["Rune of Teleportation"]) < addon.db.profile.RestockTeleport or
GetItemCount(L["Rune of Portals"]) < addon.db.profile.RestockPortals then
NeedReagents = true
end
if NeedReagents and addon.db.profile.Restock then
for i = 1, GetMerchantNumItems(), 1 do
local name, texture, price, quantity, numAvailable, isUsable, extendedCost = GetMerchantItemInfo(i)
if (name == L["Arcane Powder"] or name == L["Rune of Teleportation"] or name == L["Rune of Portals"]) then
if addon.db.profile.RestockConfirm then
StaticPopup_Show("RESTOCK_REAGENTS")
else
WittyMage:RestockReagents()
end
IsReagentVendor = true
break;
end
end
end|||I use ReagentRestocker for this and I'm sure you could check their code (it can sell greys for you as well). A simple macro solution to buy 10 each of Arcane Powder and Rune of Portals would look something like this:
/run for i=1,GetMerchantNumItems() do local n,t,p,q,r,s,v=GetMerchantItemInfo(i) if (strfind(n,"Arcane Powder") or strfind(n,"Rune of Portals")) then BuyMerchantItem(i,10) end end
No comments:
Post a Comment