Twitchy250 |
10-26-16 02:55 PM |
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
Urchin.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>
Core.xml
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>
Urchin.lua
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
Statistics
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>
Right now I plan on fixing the UI once I feel I have a hold of things.
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 :)
|