1. I'm having trouble figuring out how to use the _OnEvent function, and have looked at several examples, but can't seem to figure out why mine won't work.

    In my .xml, I have

    <Frame name="Listener">
    </Frame>
    

    and in my .lua, i have

     function RegisterEvents()
        Listener:RegisterEvent("AUCTION_ITEM_LIST_UPDATE")
        QueryAuctionItems("of waves", 0, 0, 0, 0, 0, 0, 0, 0, 0)
     end
    
     function Listener_OnEvent()
        print ("listener reached")
     ..
     end
    

    The QueryAuctionItems runs, because I see the result (I have more code that involves a button being clicked), but the listener_OnEvent function is never reached. Perhaps I'm not understanding a piece of something... Can anyone help me out?

    Thanks, Moiraine

  2. Did you call the RegisterEvents function ?

    Listener:RegisterEvent("AUCTION_ITEM_LIST_UPDATE")

    I think this won't work i would do something like

     <Frame name="Listener">
       <Scripts>
         <OnLoad function="Listener_OnLoad"/>
         <OnEvent function="Listener_OnEvent"/>
       </Scripts>
     </Frame>
    

    and

     -- Register events
     function Listener_OnLoad(self)
       self:RegisterEvent("AUCTION_ITEM_LIST_UPDATE")
     end
    
     -- this function is called every time the registered event occures
     function Listener_OnEvent(self, event, ...)
       --handle events
     end
    
  3. Indeed, you've registered for the event, but you dont' se an event handler.. so your code never runs.

  4. I see what you guys mean now - I thought perhaps a frame automatically had the _OnStuff functions attached by default because that's all I ever saw. However, my function still isn't firing (and I turned off auctioneer etc to test... is there a better way to test than to constantly reboot wow?)

    Although I don't think the parameters are needed (I assumed they work like javascript after browsing through some examples), I added them to see if it would change anything:

     function Listener_OnLoad(self)
             self:RegisterEvent("AUCTION_ITEM_LIST_UPDATE")
     end
    
     function Listener_OnEvent(self, event, ...)
        print ("listener reached") // this is never reached
     ..
     end
    

    and the .xml file now contains:

        <Frame name="Listener">     
            <OnLoad function="Listener_OnLoad"/>
                <OnEvent function="Listener_OnEvent"/>
        </Frame>
    
  5. The params aren't needed if you aren't using them, but get into the habit now of ALWAYS including them.. it will make your life infinitely easier.

    I don't see any particular reason why your code might not be working. Perhaps register another event that you know occurs, like UPDATE_MOUSEOVER_UNIT, which you can trigger by moving your mouse over a unit in the 3d world and do some more testing.

    You don't have to restart wow, just run the /reload command. This wont' work if you're adding new texture files, but that's not what you're doing.

  6. Thanks for the tip on /reload

    After adding random print statements it appears that the onload function doesn't even run.

    I've tried changing OnLoad to onLoad just incase, and even added

    print ("reload works confirmed")
    Listener:RegisterEvent("AUCTION_ITEM_LIST_UPDATE")
    Listener:RegisterEvent("UPDATE_MOUSEOVER_UNIT")
    

    to my RegisterEvents() function, which I know is running... maybe I'm missing a more basic line somewhere?

  7. Ugh, I just realized i forgot to wrap <Script> around the onload/onevent lines in the xml, sorry, that fixed it