Hello, I'm new to addon development and can't get QueryAuctionItems to work. (it's for WoW Classic).
AUCTION_ITEM_LIST_UPDATE fires when searching manually, but not when programmatically queried. However, "AH is queryable" is printed. On a super rare occasion it has worked, and I have no idea why. The code is below, surely I'm doing something wrong.
Code:
Sandbox = { }
-- Code ...
local frame = CreateFrame("FRAME");
frame:RegisterEvent("ADDON_LOADED");
frame:RegisterEvent("PLAYER_LOGOUT");
frame:RegisterEvent("AUCTION_ITEM_LIST_UPDATE");
frame:RegisterEvent("AUCTION_HOUSE_SHOW");
-- Slash Commands ...
SlashCmdList["SANDBOX"] = function()
print("Slash Sandbox");
frame:QueryAH();
end
SLASH_SANDBOX1 = "/sandbox";
SLASH_SANDBOX2 = "/sb";
function frame:OnEvent(event, arg1)
if event == "ADDON_LOADED" and arg1 == "Sandbox" then
print("Sandbox");
end
if event == "AUCTION_ITEM_LIST_UPDATE" then
print("AH update");
batch,count = GetNumAuctionItems("list");
end
if event == "AUCTION_HOUSE_SHOW" then
print("AH show");
frame:QueryAH();
end
end
frame:SetScript("OnEvent", frame.OnEvent);
function frame:QueryAH()
if CanSendAuctionQuery() then
print("AH is queryable");
QueryAuctionItems("", nil, nil, 0, 0, 0, 0, 0, 0, 0);
else
print("AH is not queryable");
end
end
Much appreciated.