1. I know I can use QueryAuctionItems("",0,0,0,0,0,0,0,0,true) to return a compete list of the AH, rather than the 50 items that GetAuctionItemInfo("list",index) limits me to, but I cant find out how to get my hands on the actual information once I have performed the QueryAuctionItems function. I am aware that it can only be called every 15mins, but this wont be a problem for me.

    My intention is to read the whole contents of the AH and store the data in a table - I would then be able to read the contents of the table without continually hammering the AH.

    my code is something similar to:

    batch,whole=CanSendAuctionQuery("list")

    datatable={}

    _,NumberOfAuctions=GetNumAuctionItems("list")

    if whole=1

    QueryAuctionItems("",0,0,0,0,0,0,0,0,true)

    for auctionitem=1,NumberOfAuctions

    name,texture,count,quality,canUse,level,minBid,minIncrement,buyoutPrice,bidAmount,highBidder,owner=GetAuctionItemInfo("list",auctionitem)

    table.insert(datatable,auctionitem,name)

    end

    end

     

     To my simple mind the above should work - but at best it will only produce the 1st 50 items (ie page one).

    My character is at the AH, and I have targetted an auctioneer and opened the std blizzard auction window. I dont get any information back unless I hit the search button in the top right of the AH broswer which then displays the 1st 50 items. My code will then work, but only for the 1st 50 items, not the whole AH. I'm probably missing something simple, but I cant see it. Any ideas would be greatfully received, but please dont refer me to http://wowprogramming.com/docs/api/QueryAuctionItems as that doesn't answer my questions, and the book (whilst great) is sadly lacking in any real examples of this type of code.

  2. I know I can use QueryAuctionItems("",0,0,0,0,0,0,0,0,true) to return a compete list of the AH, rather than the 50 items that GetAuctionItemInfo("list",index) limits me to, but I cant find out how to get my hands on the actual information once I have performed the QueryAuctionItems function. I am aware that it can only be called every 15mins, but this wont be a problem for me.

    My intention is to read the whole contents of the AH and store the data in a table - I would then be able to read the contents of the table without continually hammering the AH.

    my code is something similar to:

    batch,whole=CanSendAuctionQuery("list")

    datatable={}

    _,NumberOfAuctions=GetNumAuctionItems("list")

    if whole=1

    QueryAuctionItems("",0,0,0,0,0,0,0,0,true)

    for auctionitem=1,NumberOfAuctions

    name,texture,count,quality,canUse,level,minBid,minIncrement,buyoutPrice,bidAmount,highBidder,owner=GetAuctionItemInfo("list",auctionitem)

    table.insert(datatable,auctionitem,name)

    end

    end

     

     To my simple mind the above should work - but at best it will only produce the 1st 50 items (ie page one).

    My character is at the AH, and I have targetted an auctioneer and opened the std blizzard auction window. I dont get any information back unless I hit the search button in the top right of the AH broswer which then displays the 1st 50 items. My code will then work, but only for the 1st 50 items, not the whole AH. I'm probably missing something simple, but I cant see it. Any ideas would be greatfully received, but please dont refer me to http://wowprogramming.com/docs/api/QueryAuctionItems as that doesn't answer my questions, and the book (whilst great) is sadly lacking in any real examples of this type of code.

  3. Actually I've found the answer myself - I needed to check for an Auction_Item_List_Update event after the QueryAuctionItems() command. It now works fine.

     

  4. I know this is a while since you posted, but would you mind sharing your solution?

    I have been working with this a while and still struggling at getting the data into a table to be used.

    Thanks for your time.

  5. Hi, as i said - you need to use the event system to get this working. (Sorry about the strange italics that crop up here)

    in the MyFrameOnload() section of your lua file, use a line similar to: MyFrame:RegisterEvent("AUCTIONITEMLISTUPDATE")

    then put this function somewhere (i stuck it at the bottom of the lua file to keep it out of the way)

    function MyFrame_OnEvent(frame,event,...)

    if event=="AUCTION_ITEM_LIST_UPDATE" then
              ReadTheAuctionHouse()
    end
    

    end

    I have on my screen a button, which when clicked will read the AH into a table.

    function MyButton_OnClick()

         local CanDoWholeQuery
         _,CanDoWholeQuery=CanSendAuctionQuery("list")
         while CanDoWholeQuery~=1 do
               FiveSecondDelay() -- just prevents hammering the CanSendAuctionQuery
               _,CanDoWholeQuery=CanSendAuctionQuery("list")
         end
    
         --when CanDoWholeQuery is 1, we are allowed to actually query the AH, so:
    
         QueryAuctionItems("",0,80,0,0,0,0,false,0,true)
         -- this can only be done once every 15 mins
    

    end

    -- everything now waits for the AUCTIONITEMLIST_UPDATE event to fire -- and the Event Checking routine calls the ReadTheAuctionHouse function

    Function ReadTheActionHouse()

        local MaxAuctions
        _,MaxAuctions = GetNumAuctionItems("list")
        for tableloop=1,MaxAuctions
              name,texture,count,quality,canuse,level,minBid,minIncrement,
              buyoutPrice,bidAmount,highBidder,owner,
              salestatus=GetAuctionItemInfo("list",tableloop)
    

    -- at this point you would put the data you want into your table -- for instance:

              MyTable[#MyTable+1]=name
        end
    

    end

    You should now have a table, 15000+ records long, storing all the names of the items up for auction.

    Note: do not split the lines making up the GetAuctionItemInfo command, i've only done this for clarity reasons.

    Many people will tell you that there are more efficient ways of reading the AH, but none of them have been understandable, at least not to me. I've tried working through several Auctioneer addons, but nothing is very clear. This method works for me, the only thing you need to remember is that there is limit on using the GetAll part of the AH Query - you can only perform this once every 15mins.

    function FiveSecondDelay()

    local delay
    delay=time()+4
    while time()<delay do
    end
    

    end

    function MyFrame_OnEvent(frame,event,...)

    if event=="AUCTION_ITEM_LIST_UPDATE" then
              ReadTheAuctionHouse()
    end
    

    end

    Hope this helps

  6. If you use the "Code" button at the top of the editor, you don't get the italics and you can actually have all of your code look right. Thanks for sharing.

  7. could you release this as a standalone addon? im not much of a lua programmer but i would like to dump all ah data into a file so i can process it outside of wow with php.

  8. bump