QueryAuctionItems not working - WoWInterface
Thread Tools Display Modes
01-23-21, 09:11 AM   #1
A Murloc Raider
Join Date: Jan 2021
Posts: 4
Smile QueryAuctionItems not working

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.

Sandbox = { }

-- Code ...
local frame = CreateFrame("FRAME");

-- Slash Commands ...
SlashCmdList["SANDBOX"] = function()
    print("Slash Sandbox");
SLASH_SANDBOX1 = "/sandbox";

function frame:OnEvent(event, arg1)
    if event == "ADDON_LOADED" and arg1 == "Sandbox" then

    if event == "AUCTION_ITEM_LIST_UPDATE" then
        print("AH update");
        batch,count = GetNumAuctionItems("list");

    if event == "AUCTION_HOUSE_SHOW" then
        print("AH show");

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);        
        print("AH is not queryable");
Much appreciated.

Last edited by S4m : 01-24-21 at 07:18 AM.
  Reply With Quote
01-24-21, 06:18 PM   #2
A Murloc Raider
Join Date: Jan 2021
Posts: 4
Cool EDIT problem found

I think I found it, upon looking again. I noticed it only works once, so e.g. upon every login - a detail I somehow missed and failed to check. Two things obscured it. The query has a small loading time. Furthermore, the search results displayed are wiped after changing tabs (bids, or own auctions). So, switching tabs before the results were displayed made it seem like nothing had happened, although the messages were printed. And subsequent queries via the slash command didn't actually alter the already existing results, so 'update' didn't fire.

The following are some directions regarding my question from another forum. They're a bit fragmented, but might be helpful nonetheless:

is the AH window open when the query is fired?

does lua require return types

in function headers

I've never used it

I just don't know if this function returns a value or not


looks like it doesn't?

in someone else's code they do this:


QueryAuctionItems(name, nil, nil, 0, 0, 0, Scan.tryPage, 0, 0)
Scan.eventObject:RegisterEvent("AUCTION_ITEM_LIST_UPDATE", function()

is the auction item list update thing sep

is it a flag

that you mark as set

and the frame checks that when it redraws?

i've never worked with this stuff but that's what i'd guess

you'd need to manually register and unregister the event

and refresh the frame

the show() call is probably doing it there

it's like with file io where you are manipulating a buffer the whole time until you sync() or flush() the buffer

Last edited by S4m : 01-24-21 at 06:21 PM.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » QueryAuctionItems not working

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off