Semi-automatically change talents
I'm working on an add-on that will remind people to change their talents before specific boss fights (by their personal choice, of course). Is there a way to automate any part of the talent switching process?
(The holy grail here would be creating a button that says Click Here To Learn These 4 Talents, but I've been unable to find a way to do that) |
Ro posted a talent-swapping macro here, but apparently it's not always reliable when trying to switch multiple talent tiers at once.
You could use a secure action button with type = macro and dynamically build up a macro for each tier you need to swap. |
Hmmm... that thread implies that it's possible to switch one talent with an add-on, but doesn't say how. Does it mean the way to do this via add-on is, as you said, to make a secure button which creates and calls that sort of talent swapping macro?
Also I'm starting to think it might be best to not fully automate it anyway, but to list the talents that you presumably want to learn and put a button next to each. |
should be possible:
http://wow.gamepedia.com/World_of_Wa...lent_Functions have a look at the last 3 there. |
Quote:
[Edit] And while I'm at it, how can I open the talents frame programmatically? |
You can call LearnTalents, you don't even need a hardware event for it.
All the issues are from RemoveTalent, which is not only locked to hardware events, but can only be called from blizzard code. The only calls to the function and made in the StaticPopup handlers in Blizzard_TalentUI.lua, trigged in PlayerTalentFrameTalent_OnClick, only called by the OnClick handler for PlayerTalentButtonTemplate in Blizzard_TalentUI.xml. The talent UI needs to be loaded though a hardware event to avoid taint, the easiest way to do that is to toggle the frame though a double /click TalentMicroButton. Eventually you'll end up with something like this: Code:
/stopmacro [combat] |
Thought cause it is flagged as noncombat and not as protected it works, but while removetalent is protected learntalents is not, just tested that.
|
Quote:
Occasionally it does let you swap more than one at a time, the problem is that since it's completely inconsistent you can't rely on it correctly changing out your talents. |
You could probably dispatch the LearnTalents() call to a C_Timer.After() function.
Code:
/run C_Timer.After(1,function() LearnTalents(a,b,c,d,e,...) end) |
Alright, here's a video showing how much this doesn't work: http://youtu.be/T15HLHGL8Js
It takes 4 clicks to get it to unlearn all 7 talents because it tends to only swap up to 2 at a time, interestingly it seems to prefer the first and last ones in the macro to actually change and ignores the rest. |
Quote:
|
Quote:
Now I just need to figure out a) how to bind a secure action button to a dynamically created macro, and b) what sort of interface would make sense for picking those talents to begin with :p |
It's likely going to be more complicated than that because there is a time delay before you can change another talent, if you spam a button like that it's going to skip some of the talents because it will advance to the next item in the sequence regardless of whether it succeeded or not.
|
I can't manage to make a working macro for changing even one talent. It seems that unlearning a talent and learning another one simply won't happen from a single button press, no matter what.
|
Quote:
|
Quote:
What I'm looking for is a way to make a button unlearn a talent, pick another talent, and press the Learn button, all at once. I can't seem to write a macro that'll make that happen, and I have no idea why. |
Quote:
Code:
button:SetAttribute("type", "spell") Code:
button:SetAttribute("type", "spell") Code:
button:SetAttribute("type", "macro") Code:
button:SetAttribute("type", "macro") In Semlar's code: Code:
macro:RegisterForClicks('AnyUp', 'AnyDown') Code:
macro:SetAttribute('downbutton', 'Button31') Code:
macro:WrapScript(macro, 'OnClick', [[ <snip> ]]) Code:
self:SetAttribute('*macrotext31', '/click ' .. parent .. ' ' .. button .. '\n/click StaticPopup1Button1') Code:
self:SetAttribute('macrotext1', '/click PlayerTalentFrameTalentsLearnButton\n/use [nomounted] !Trap Launcher') This is what occurs when this button is left-clicked: 1. The "before" wrapper snippet is run. 2. The "what to do when clicked with button31" attribute is set to a macro that clicks on the currently hovered talent or glyph button (if you look elsewhere in the code you'll see that the "macro" button is parented to those OnEnter) and then accepts the current static popup. 3. The "what to do when clicked with button1" attribute is set to a macro that clicks the "Learn Talents" button. (Just going to ignore Trap Launcher.) 4. The mousedown event is received. 5. The button arg is remapped to button31. 6. The "what to do when clicked with button31" attribute is invoked, causing its macro to run. The talent is clicked and the popup is accepted. 7. The mouseup event is received. 8. The "what to do when clicked with button1" attribute is invoked, causing its macro to run. The "Learn Talents" button is clicked. You are correct that it doesn't do exactly what you wanted, but you may be able to use similar principles to accomplish what you want. |
Quote:
Thanks for explaining my code because I don't have the attention span to write all that. The reason I use two different macrotexts on the button is because one is run when you click the button down (to select the new talent) and the other is run when you release the button which clicks the "learn talents" button. If LearnTalents is not protected then that isn't necessary and you can simply call that directly when the previous talent is unlearned. |
Quote:
Quote:
|
Thanks for all the help and explanations :p
After a lot of experimentation around semlar's code, I technically have a button that switches one talent for me every time I press it. I haven't gotten around to trying to make it work for several talents yet, but here's the code I have so far, in case somebody finds it useful: Lua Code:
|
All times are GMT -6. The time now is 04:46 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI