Thread Tools Display Modes
07-03-14, 05:39 AM   #1
philipe24
A Deviate Faerie Dragon
Join Date: Jan 2014
Posts: 10
oneclick unlearn talent script

Hello,
I was wondering if its possible to kinda "remove" the confirmation for unlearn talents.
I've been trying it out like this but didnt came to a result really:

PlayerTalentFrameTalentsTalentRow1Talent1:RegisterForClicks("LeftButtonUp");
PlayerTalentFrameTalentsTalentRow1Talent1:SetScript("OnMouseDown", function(self, button)
StaticPopup1Button1:Click(MouseButton, Down)
end)


Anyone got an Idea?
  Reply With Quote
07-03-14, 05:52 AM   #2
Codelogic
A Deviate Faerie Dragon
Join Date: Jul 2014
Posts: 12
Originally Posted by philipe24 View Post
Hello,
I was wondering if its possible to kinda "remove" the confirmation for unlearn talents.
I've been trying it out like this but didnt came to a result really:

PlayerTalentFrameTalentsTalentRow1Talent1:RegisterForClicks("LeftButtonUp");
PlayerTalentFrameTalentsTalentRow1Talent1:SetScript("OnMouseDown", function(self, button)
StaticPopup1Button1:Click(MouseButton, Down)
end)


Anyone got an Idea?
Without knowing anything about programming i think this is very likely possible, like you can create a function that can Abandon more quests at once and even automatically click the confirm button. But i think you're approaching it wrong. I think it requires a click handler for them all, and not a OnMouseDown?
  Reply With Quote
07-03-14, 09:42 AM   #3
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
I'd recommend QuickTalents.
  Reply With Quote
07-03-14, 10:54 AM   #4
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Here's a hackish way to bypass the confirmation dialog with the default interface..
Lua Code:
  1. LoadAddOn('Blizzard_TalentUI')
  2. local macro = CreateFrame('button', nil, nil, 'SecureActionButtonTemplate')
  3. macro:SetAttribute('type', 'macro')
  4. macro:SetScript('OnLeave', function(self)
  5.     self:Hide()
  6.     GameTooltip_Hide()
  7.     self:GetParent():SetScript('OnLeave', GameTooltip_Hide)
  8. end)
  9.  
  10. hooksecurefunc('PlayerTalentFrameTalent_OnEnter', function(self)
  11.     if InCombatLockdown() then return end
  12.     local _, _, _, _, selected, available = GetTalentInfo(self:GetID())
  13.     if not selected and not available then
  14.         macro:SetParent(self)
  15.         macro:ClearAllPoints()
  16.         -- You can't set the points directly to the frame because it's not protected
  17.         macro:SetPoint('TOPLEFT', nil, 'BOTTOMLEFT', self:GetLeft(), self:GetTop())
  18.         macro:SetSize(self:GetSize())
  19.         self:SetScript('OnLeave', nil) -- Temporarily prevent it from hiding the tooltip
  20.         macro:SetAttribute('macrotext', format('/click %s\n/click StaticPopup1Button1', self:GetName()))
  21.         macro:Show()
  22.     end
  23. end)
If you make this into an addon you should remove LoadAddOn('Blizzard_TalentUI') and add "##Dependencies: Blizzard_TalentUI" to the toc file.
  Reply With Quote
07-03-14, 11:37 AM   #5
Codelogic
A Deviate Faerie Dragon
Join Date: Jul 2014
Posts: 12
Originally Posted by semlar View Post
Here's a hackish way to bypass the confirmation dialog with the default interface..
Lua Code:
  1. LoadAddOn('Blizzard_TalentUI')
  2. local macro = CreateFrame('button', nil, nil, 'SecureActionButtonTemplate')
  3. macro:SetAttribute('type', 'macro')
  4. macro:SetScript('OnLeave', function(self)
  5.     self:Hide()
  6.     GameTooltip_Hide()
  7.     self:GetParent():SetScript('OnLeave', GameTooltip_Hide)
  8. end)
  9.  
  10. hooksecurefunc('PlayerTalentFrameTalent_OnEnter', function(self)
  11.     if InCombatLockdown() then return end
  12.     local _, _, _, _, selected, available = GetTalentInfo(self:GetID())
  13.     if not selected and not available then
  14.         macro:SetParent(self)
  15.         macro:ClearAllPoints()
  16.         -- You can't set the points directly to the frame because it's not protected
  17.         macro:SetPoint('TOPLEFT', nil, 'BOTTOMLEFT', self:GetLeft(), self:GetTop())
  18.         macro:SetSize(self:GetSize())
  19.         self:SetScript('OnLeave', nil) -- Temporarily prevent it from hiding the tooltip
  20.         macro:SetAttribute('macrotext', format('/click %s\n/click StaticPopup1Button1', self:GetName()))
  21.         macro:Show()
  22.     end
  23. end)
If you make this into an addon you should remove LoadAddOn('Blizzard_TalentUI') and add "##Dependencies: Blizzard_TalentUI" to the toc file.
can i ask what the _, _, _, _, does? Is it because you added return values selected and available, and those are the only two you wish to focus on and ignore the rest?
  Reply With Quote
07-03-14, 11:55 AM   #6
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
I only care about 2 of the return values so I discard the ones that come before them by assigning them to a throwaway variable.
  Reply With Quote
07-03-14, 12:01 PM   #7
Codelogic
A Deviate Faerie Dragon
Join Date: Jul 2014
Posts: 12
Originally Posted by semlar View Post
I only care about 2 of the return values so I discard the ones that come before them by assigning them to a throwaway variable.
Thank you
  Reply With Quote
07-04-14, 05:23 AM   #8
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
To elaborate, naming the variable _ doesn't actually do anything that naming it selected or NYAN_CAT or anything else does; it's just a programmer's naming convention. If you're only going to use the last 2 values, then these all do the same thing:
  1. local _, _, _, _, selected, available = GetTalentInfo(self:GetID())
  2. local name, texture, tier, column, selected, available = GetTalentInfo(self:GetID())
  3. local selected, selected, selected, selected, selected, available = GetTalentInfo(self:GetID())
  4. local available, available, available, available, selected, available = GetTalentInfo(self:GetID())
  5. local selected, available, selected, available, selected, available = GetTalentInfo(self:GetID())
  6. local cat, cat, cat, cat, selected, available = GetTalentInfo(self:GetID())
  7. local cat, dog, pony, unicorn, selected, available = GetTalentInfo(self:GetID())

Using an underscore is just an easy way to make it obvious (to you and anyone else reading your code) that a particular variable isn't important.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » oneclick unlearn talent script

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off