View Single Post
04-26-24, 02:19 AM   #26
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,955
It should already be ignoring the other items.

Also, looking at your line for BuyMerchantItem - the wiki page doesn't say it returns a value, so it will always be false I suspect. This could be the cause of your problem
https://warcraft.wiki.gg/wiki/API_BuyMerchantItem

Lua Code:
  1. local function BuyItemsFromVendor(vendorName)
  2.     --  Create a table of items for this vendor's name
  3.     local vendor = vendors[vendorName]  
  4.     -- No items ?  Then don't bother with the rest of the work
  5.     if not vendor then return end              
  6.  
  7.     local numItems = GetMerchantNumItems()
  8.     for i = numItems, 1, -1 do
  9.         local name = GetMerchantItemInfo(i)
  10.         -- Is this item in the list of items for this vendor we want to buy ?
  11.         if vendor[name] then                      
  12.             local success = BuyMerchantItem(i)
  13.             if success then
  14.                 PrintMessage("Purchased: " .. name)
  15.             else
  16.                 PrintMessage("Failed to purchase: " .. name)
  17.             end
  18.         end
  19.     end
  20. end
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote