Go to Page... |
Thread Tools | Display Modes |
10-26-16, 02:55 PM | #1 |
CanSendAuctionQuery Always False and Reading AH Help
Hello WoW Interface,
I am here to see if I can get help having to do with my last post. The code has changed a lot and couldn't figure out how to delete the last post, but hopefully this one will be more straight forward. I feel as if I'm getting a lot closer to figuring this out. I am working on a simple AH Addon and had gotten a lot of help through a google search. Urchin.toc Code:
## Interface: 70000 ## Title: Urchin 1 ## Version: 0.1 ## LoadOnDemand: 1 ## LoadWith: Blizzard_AuctionUI ## SavedVariablesPerCharacter: MyTable Urchin.lua Core.xml Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/"> <Frame name="myTabContainerFrame" toplevel="true" frameStrata="DIALOG" movable="true" enableMouse="true" hidden="false" parent="AuctionFrame"> <Size> <AbsDimension x="480" y="325"/> </Size> <Anchors> <Anchor point="CENTER"> <Offset><AbsDimension x="650" y="-15"/></Offset> </Anchor> </Anchors> <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true"> <BackgroundInsets> <AbsInset left="11" right="12" top="12" bottom="11"/> </BackgroundInsets> <TileSize> <AbsValue val="32"/> </TileSize> <EdgeSize> <AbsValue val="32"/> </EdgeSize> </Backdrop> <Layers> <Layer level="ARTWORK"> <Texture name="UrchinmyFrameHeader" file="Interface\DialogFrame\UI-DialogBox-Header"> <Size> <AbsDimension x="356" y="64"/> </Size> <Anchors> <Anchor point="TOP"> <Offset> <AbsDimension x="0" y="12"/> </Offset> </Anchor> </Anchors> </Texture> <FontString inherits="GameFontNormal" text="Urchin"> <Anchors> <Anchor point="TOP" relativeTo="UrchinmyFrameHeader"> <Offset> <AbsDimension x="0" y="-14"/> </Offset> </Anchor> </Anchors> </FontString> </Layer> </Layers> <Frames> <Button name="AuctionFrameTab50" inherits="AuctionTabTemplate" id="50" text="Statistics"> <Anchors> <Anchor point="TOPLEFT" relativePoint="TOPRIGHT"> <Offset> <AbsDimension x="-8" y="0"/> </Offset> </Anchor> </Anchors> <Scripts> <OnClick> AuctionFrameTab_OnClick(self, button) UrchinStatistics:Show() </OnClick> </Scripts> </Button> <Button name="AuctionFrameTab60" inherits="AuctionTabTemplate" id="60" text="Clear Tab"> <Anchors> <Anchor relativeTo="AuctionFrameTab50"> <Offset> <AbsDimension x="0" y="-35"/> </Offset> </Anchor> </Anchors> <Scripts> <OnClick> UrchinStatistics:Hide(); </OnClick> </Scripts> </Button> </Frames> <Scripts> <OnLoad>self:RegisterForDrag("LeftButton");</OnLoad> <OnDragStart>self:StartMoving();</OnDragStart> <OnDragStop>self:StopMovingOrSizing();</OnDragStop> <OnEvent></OnEvent> </Scripts> </Frame> </Ui> Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/"> <Include file="Urchin.xml" /> <Include file="UI/Statistics.xml" /> <!-- Frame to handle all core events --> <Frame name="Atr_core"> <Scripts> <OnLoad>Atr_RegisterEvents( self )</OnLoad> <OnUpdate></OnUpdate> <OnEvent>Atr_EventHandler( self, event, ... )</OnEvent> </Scripts> </Frame> </Ui> Code:
function Atr_RegisterEvents(self) self:RegisterEvent("AUCTION_ITEM_LIST_UPDATE"); self:RegisterEvent("AUCTION_HOUSE_CLOSED"); self:RegisterEvent("ADDON_LOADED"); end function Atr_EventHandler(self, event, ...) if (event == "AUCTION_ITEM_LIST_UPDATE") then UrchinReadAH(); end; if (event == "AUCTION_HOUSE_CLOSED") then Atr_OnAuctionHouseClosed(); end; if (event == "ADDON_LOADED") then UrchinAddonLoaded(); end; end function Atr_OnAuctionHouseClosed() UrchinStatistics:Hide(); end function MyButton_OnClick() MyTable = {{1,2,3}, {4,5,6}, {7,8,9}} local canQuery,canMassQuery canQuery, canMassQuery = CanSendAuctionQuery() --_,CanDoWholeQuery=CanSendAuctionQuery("list") if canQuery~=1 then print("can not Normal query"); else print("Can Normal Query"); end if canMassQuery~=1 then print("can not full query"); else print("Can Full Query"); end --while canMassQuery~=1 do -- print("15 Minutes Not Up"); --FiveSecondDelay() -- just prevents hammering the CanSendAuctionQuery --canQuery,canMassQuery=CanSendAuctionQuery("owner") --end QueryAuctionItems("Runic Catgut",0,80,0,0,0,0,false,0,false) -- QueryAuctionItems( "", nil, nil, 0, nil, nil, true, false, nil ) end function UrchinReadAH() print("Reading AH"); local totalAuctions numBatchAuctions, totalAuctions = GetNumAuctionItems("list") --numBatchAuctions, MaxAuctions = GetNumAuctionItems("owner") --_,MaxAuctions = GetNumAuctionItems("list") for tableloop=1,totalAuctions do name, texture, count, quality, canUse, level, minBid, minIncrement, buyoutPrice, bidAmount, highestBidder, owner, sold=GetAuctionItemInfo("list",tableloop) MyTable[#MyTable+1]=name print("Troubleshooting: Recording"); end end function FiveSecondDelay() local delay delay=time()+14 while time()<delay do end end function UrchinPrintTable() --a = {{1,2,3}, {4,5,6}, {7,8,9}} for i = 1, #MyTable do local v = MyTable[i][1] print(v) end end function UrchinAddonLoaded() if (MyTable == nil) then print("Prepairing Urchin Database Creation"); MyTable = {} end; --MyTable = {} return MyTable end Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/"> <Frame name="UrchinStatistics" toplevel="true" frameStrata="DIALOG" movable="true" enableMouse="true" hidden="true" parent="AuctionFrame"> <Size> <AbsDimension x="825" y="396"/> </Size> <Anchors> <Anchor point="CENTER"> <Offset><AbsDimension x="6" y="6"/></Offset> </Anchor> </Anchors> <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true"> <BackgroundInsets> <AbsInset left="11" right="12" top="12" bottom="11"/> </BackgroundInsets> <TileSize> <AbsValue val="32"/> </TileSize> <EdgeSize> <AbsValue val="32"/> </EdgeSize> </Backdrop> <Layers> <Layer level="ARTWORK"> <Texture name="myFrameHeader" file="Interface\DialogFrame\UI-DialogBox-Header"> <Size> <AbsDimension x="356" y="64"/> </Size> <Anchors> <Anchor point="TOP"> <Offset> <AbsDimension x="0" y="12"/> </Offset> </Anchor> </Anchors> </Texture> <FontString inherits="GameFontNormal" text="My Frame"> <Anchors> <Anchor point="TOP" relativeTo="myFrameHeader"> <Offset> <AbsDimension x="0" y="-14"/> </Offset> </Anchor> </Anchors> </FontString> </Layer> </Layers> <Frames> <Frame name="OptionsPane" hidden="false"> <Size> <AbsDimension x="220" y="396"/> </Size> <Anchors> <Anchor point="TOPLEFT"/> <Anchor point="BOTTOMLEFT"/> </Anchors> <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true"> <BackgroundInsets> <AbsInset left="11" right="12" top="12" bottom="11"/> </BackgroundInsets> <TileSize> <AbsValue val="32"/> </TileSize> <EdgeSize> <AbsValue val="32"/> </EdgeSize> </Backdrop> <Layers> <Layer level="ARTWORK"> <FontString inherits="GameFontNormal" text="Options Pane"> <Anchors> <Anchor point="TOPLEFT" relativeTo="$parent"> <Offset> <AbsDimension x="20" y="-30"/> </Offset> </Anchor> </Anchors> </FontString> </Layer> </Layers> </Frame> <Frame name="OptionsPaneTop" hidden="false"> <Size> <AbsDimension x="620" y="150"/> </Size> <Anchors> <Anchor point="TOPRIGHT"/> </Anchors> <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true"> <BackgroundInsets> <AbsInset left="11" right="12" top="12" bottom="11"/> </BackgroundInsets> <TileSize> <AbsValue val="32"/> </TileSize> <EdgeSize> <AbsValue val="32"/> </EdgeSize> </Backdrop> <Layers> <Layer level="ARTWORK"> <FontString inherits="GameFontNormal" text="Options Pane"> <Anchors> <Anchor point="TOPLEFT" relativeTo="$parent"> <Offset> <AbsDimension x="20" y="-30"/> </Offset> </Anchor> </Anchors> </FontString> </Layer> </Layers> </Frame> <Button name="UrchinFullScan" inherits="AuctionTabTemplate" id="70" text="Full Scan"> <Anchors> <Anchor point="TOPRIGHT" relativePoint="TOPRIGHT"> <Offset> <AbsDimension x="-8" y="-10"/> </Offset> </Anchor> </Anchors> <Scripts> <OnClick> print("Full Scan in Progress"); MyButton_OnClick(); </OnClick> </Scripts> </Button> <Button name="PrintTable" inherits="AuctionTabTemplate" id="80" text="Print Table"> <Anchors> <Anchor point="TOPRIGHT" relativePoint="TOPRIGHT"> <Offset> <AbsDimension x="-8" y="-50"/> </Offset> </Anchor> </Anchors> <Scripts> <OnClick> print("Print Table"); UrchinPrintTable(); </OnClick> </Scripts> </Button> <Frame name="UrchinResults" hidden="false"> <Size> <AbsDimension x="620" y="260"/> </Size> <Anchors> <Anchor point="BOTTOMRIGHT"/> </Anchors> <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true"> <BackgroundInsets> <AbsInset left="11" right="12" top="12" bottom="11"/> </BackgroundInsets> <TileSize> <AbsValue val="32"/> </TileSize> <EdgeSize> <AbsValue val="32"/> </EdgeSize> </Backdrop> <Layers> <Layer level="ARTWORK"> <FontString inherits="GameFontNormal" text="Results"> <Anchors> <Anchor point="TOPLEFT" relativeTo="$parent"> <Offset> <AbsDimension x="20" y="-30"/> </Offset> </Anchor> </Anchors> </FontString> </Layer> </Layers> </Frame> </Frames> </Frame> </Ui> I am having troubles figuring out why every time I send the CanSendAuctionQuery function it always comes up as false. Also it appears as though the event handler for AUCTION_ITEM_LIST_UPDATE isn't calling the UrchinReadAH function. I have been trying to comment lines of code out and using the print function to trouble shoot where the issues could lie. If anyone could help me figure out why the CanSendAuctionQuery is always turning false and why the UrchinReadAH isn't being called it would be greatly appreciated! Thank you all in advanced |
|
10-26-16, 03:34 PM | #2 |
Just realized I forgot to update to the new patch version, which didn't make a difference. But I did reenable Auctionator which at the moment uses some of the same function names and forgot to disable Urchin and the UrchinReadAH function kicked in, so I have to look into Auctionator and figure out why it was able to call the function properly ( look into why the AUCTION_ITEM_LIST_UPDATE event kicked in with Auctionator).
I think my problem lies in why the AUCTION_ITEM_LIST_UPDATE isn't kicking in |
|
10-26-16, 03:44 PM | #3 |
Hi,
Your check is failing because CanSendAuctionQuery returns a boolean (true/false), but you check for 1. A lot of functions that now returns a boolean used to return 1/nil, which probably is the info that you found? Don't know about the event. Add a print in the event handler to see if the event is firing as expected. Some other feedback, if you don't mind! You're leaking a lot of global variables needlessly. This is not inherently bad, at least not as long as they are uniquely named, but generally you should avoid globals unless you have a reason to use them. All of these are global which may conflict with other addons that made the same mistake, or worse; the default UI. Code:
name, texture, count, quality, canUse, level, minBid, minIncrement, buyoutPrice, bidAmount, highestBidder, owner, sold=GetAuctionItemInfo("list",tableloop) You don't need to declare variables local separately before assigning values to them. Just do it on the same line. I would also recommend looking into creating your frames in Lua instead of XML. It will require some work, but you may find that it's smoother than dealing with XML.
__________________
Grab your sword and fight the Horde! |
|
10-26-16, 04:57 PM | #4 |
More feedback: MyTable is a terrible name for a saved variable. It is not descriptive, nor given any context, and the name itself is far too generic and could easily be overwritten by someone else leaking a global variable by the same name that contains entirely different data.
I suggest UrchinDB. It is unique, descriptive, and has context. |
|
10-26-16, 06:18 PM | #5 | ||
Thank you very much for your reply's
Last edited by Twitchy250 : 10-26-16 at 06:21 PM. |
|||
10-26-16, 09:18 PM | #6 |
I managed to get it fully functional so far. I'm not fully sure what I did but I removed the ~= checks and may have altered the query command. But the Event is successfully firing and successfully writing the the saved variable
|
|
10-27-16, 03:04 AM | #7 |
Oops, I meant "Functions can and should also be made local", of course! Yours are already global, and you define local functions in the same way you do variables.
Code:
local function private() end function public() end
__________________
Grab your sword and fight the Horde! |
|
WoWInterface » Developer Discussions » Lua/XML Help » CanSendAuctionQuery Always False and Reading AH Help |
«
Previous Thread
|
Next Thread
»
|
Thread Tools | |
Display Modes | |
|
|