Thread Tools Display Modes
02-16-15, 05:37 PM   #21
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Malsomnus View Post
Lua Code:
  1. f.btn:SetScript ('PostClick', function()
  2.   C_Timer.After(1, function ()
  3.     PlayerTalentFrameTalentsLearnButton:GetScript("OnClick")(PlayerTalentFrameTalentsLearnButton)
  4.   end)  
  5. end)
You should factor that C_Timer callback out into a separate function so you're not re-creating it over and over every time you click your button:

Lua Code:
  1. local function clickLearnButton()
  2.   PlayerTalentFrameTalentsLearnButton:GetScript("OnClick")(PlayerTalentFrameTalentsLearnButton)
  3. end
  4. f.btn:SetScript ('PostClick', function()
  5.   C_Timer.After(1, clickLearnButton)  
  6. end)

You can probably also just do:

Lua Code:
  1. PlayerTalentFrameTalentsLearnButton:Click()
__________________
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
02-17-15, 11:59 AM   #22
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 758
Since this has not been posted here... ZoneSpec is nice to remind you what you used at what boss.
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________

Last edited by Tonyleila : 02-17-15 at 12:03 PM.
  Reply With Quote
02-17-15, 12:48 PM   #23
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
Originally Posted by Tonyleila View Post
Since this has not been posted here... ZoneSpec is nice to remind you what you used at what boss.
The description says it saves them per zone, which is very different from per boss.
__________________
SanityCheck - If you've ever said the words "Sorry, I forgot" then you need this add-on.

Remember, every time you post a comment on an add-on, a kitten gets its wings!
  Reply With Quote
02-17-15, 01:42 PM   #24
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 758
Originally Posted by Malsomnus View Post
The description says it saves them per zone, which is very different from per boss.
Each boss has its own (sub)zone name so it saves it for each boss, belief me I use it.
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________

Last edited by Tonyleila : 02-17-15 at 01:54 PM.
  Reply With Quote
02-17-15, 02:47 PM   #25
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
Originally Posted by Tonyleila View Post
Each boss has its own (sub)zone name so it saves it for each boss, belief me I use it.
I see... well, I'm still going to try to make a better one myself
__________________
SanityCheck - If you've ever said the words "Sorry, I forgot" then you need this add-on.

Remember, every time you post a comment on an add-on, a kitten gets its wings!
  Reply With Quote
03-05-15, 07:02 AM   #26
Banknorris
A Chromatic Dragonspawn
 
Banknorris's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 153
I was just reading this thread
http://us.battle.net/wow/en/forum/topic/11422462151
and the advanced technique used on addon AutoConfirmTalents came to my mind
Code:
local macro = CreateFrame('button', "target_enemy", nil, 'SecureActionButtonTemplate, SecureHandlerBaseTemplate')
macro:SetAttribute('type', 'macro')
macro:RegisterForClicks('AnyUp', 'AnyDown')
macro:SetAttribute('downbutton', 'Button30')

macro:WrapScript(macro, 'OnClick', [[ -- self, button, down
	self:SetAttribute('*macrotext30', '/targetenemy')
	self:SetAttribute('macrotext1', '/targetenemyplayer')
]])
Would it be possible to adapt it to use a keybind (TAB) instead of a real clicks? I am afraid it can't be done since I didn't find any down/up option on SetBindingClick api. The idea would be /targetenemy on TAB key down and /targetenemyplayer on TAB key up.

Last edited by Banknorris : 03-05-15 at 04:37 PM.
  Reply With Quote
03-05-15, 07:51 AM   #27
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Originally Posted by Banknorris View Post
Would it be possible to adapt it to use a keybind (TAB) instead of a real clicks? I am afraid it can't be done since I didn't find any down/up option on SetBindingClick api. The idea would be /targetenemy on TAB key down and /targetenemyplayer on TAB key up.
You could, but they explicitly made it impossible to combine two different types of /target commands in a macro so it's probably frowned upon.
  Reply With Quote
03-05-15, 08:49 AM   #28
Banknorris
A Chromatic Dragonspawn
 
Banknorris's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 153
but they explicitly made it impossible to combine two different types
Those commands can only be used once per macro, but macrotext1 and *macrotext30 are 2 independent macros (well not totally independent since they are both in the same frame) triggered by 2 separated hardware events.

EDIT:

Works!:

Code:
local f = CreateFrame("button","clever_target",nil,"SecureActionButtonTemplate")
f:RegisterForClicks("AnyUp","AnyDown")
f:SetAttribute("type","macro")
f:SetAttribute("downbutton","Button31")
f:SetAttribute("*macrotext31","/targetenemy")
f:SetAttribute("macrotext1","/targetenemyplayer")
SetBindingClick("TAB","clever_target")

Last edited by Banknorris : 03-05-15 at 02:15 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Semi-automatically change talents


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