View Single Post
01-08-21, 07:45 PM   #1
Jamien
A Defias Bandit
Join Date: Jan 2021
Posts: 2
Secureactionbuttontemplate with a variable attribute

I've made a quick WeakAura for tracking buffs/debuffs for myself and the other tank in our raid, with a button that pops up on Readycheck if there is no focus.
Left clicking the button targets the other tank, right click focuses.

At present I have this (which works fine, but only on our mains):

Code:
local region = aura_env.region
local b = CreateFrame("Button", "FocusBtn", region, "SecureActionButtonTemplate")
b:RegisterForClicks("LeftButtonUp","RightButtonUp")
b:SetAllPoints(region)

if UnitName("player") == "Niian" then
    b:SetAttribute("*type1", "macro")
    b:SetAttribute("macrotext", "/target Aswm")
end

if UnitName("player") == "Aswm" then
    b:SetAttribute("*type1", "macro")
    b:SetAttribute("macrotext", "/target Niian")
end

b:SetAttribute("*type2","focus")
I can easily enough scan through the raid and create a variable with the name of the other tank, but is there a way that I can then use this variable in a secureactionbuttontemplate button? I've tried a few times but haven't been able to get it to work.
Thanks!
  Reply With Quote