1. Hello,

    I've written an addon to switch between talents, and came across something interesting. When triggering on PLAYER_TALENT_UPDATE, PLAYER_ENTERING_WORLD, and VARIABLES_LOADED, and displaying the talent distributions on each event, here is what I get during a normal login:

     PLAYER_TALENT_UPDATE: primary (0,0,0), secondary (0,0,0)
     VARIABLES_LOADED: primary (0,0,0), secondary (0,0,0)
     PLAYER_ENTERING_WORLD: primary (0,0,0), secondary (0,0,0)
     PLAYER_TALENT_UPDATE: primary (31,2,0), secondary (2,31,0)
    

    I have two questions about this:

    1) On page 142 of your book (2nd edition) it states that VARIABLES_LOADED launches somewhere after PLAYER_ENTERING_WORLD. To me it seems to be the other way around, but perhaps I am missing something, or has it changed?

    2) For my addon I now use the following quick and dirty fix: I only trigger on PLAYER_TALENT_UPDATE and have a global counter. IF this counter is not 1 (because then the talents have not been 'set up' yet) nothing happens, otherwise the script continues. My question: is there an event to trigger on which will always occur upon login AND happens AFTER the talents have been set?

    Best regards, KVEX

  2. 1) On page 142 of your book (2nd edition) it states that VARIABLES_LOADED launches somewhere after PLAYER_ENTERING_WORLD. To me it seems to be the other way around, but perhaps I am missing something, or has it changed?

    The VARIABLES_LOADED event can fire before PLAYER_ENTERING_WORLD, but it depends entirely on how long it takes for the data to be queried from the server. I wouldn't rely on the order with relation to PLAYER_ENTERING_WORLD as that doesn't seem very useful.

    If you need to watch for keybindings, etc. then use that event. Otherwise, you shouldn't really be using it.. it's a red herring.

    2) For my addon I now use the following quick and dirty fix: I only trigger on PLAYER_TALENT_UPDATE and have a global counter. IF this counter is not 1 (because then the talents have not been 'set up' yet) nothing happens, otherwise the script continues. My question: is there an event to trigger on which will always occur upon login AND happens AFTER the talents have been set?

    It seems to me that the PLAYER_TALENT_UPDATE does precisely what you want it to do. It may return 0/0/0 during one firing of the event, most likely to indicate that the information about the three talent trees are available but that the player's actual distribution is not. Then the second update comes, indicating that the distribution is available.

    It seems fairly simple, just use that event and update the 'state' of your addon accordingly with the event changing. I don't know the specific application, but is that a reason that won't work?