#Help with custom code weakaura

30 messages · Page 1 of 1 (latest)

stuck mantle
#

Hi there, I am trying to create a smart group weakaura to get the number of healing spells active in my group. Additionally, I've created a button that I'd like to use to target the %UnitName with the least remaining duration so that I can recast this spell.

However, I am not sure how to read the %UnitName value outside of text fields. Any guidance would be greatly appreciated!

chrome valve
#

You can't create a bot

stuck mantle
#

Some code snippets:

Actions > On Init:

if not aura_env.button then
    print('start button')
    local r = aura_env.region
    aura_env.button = CreateFrame("Button", "ConsumeButton", r, "SecureActionButtonTemplate")  
end

aura_env.button:SetAllPoints()
aura_env.button:RegisterForClicks("LeftButtonDown", "LeftButtonUp")
aura_env.button:SetAttribute("type", "spell")

Conditions > Run Custom Code:

aura_env.button:SetAttribute("unit", %UnitName) <- this is where I need help
chrome valve
#

!clickable

boreal nightBOT
stuck mantle
#

Hi Jods, I'd assume that information is somewhere to be fetched... is there anyway to read that value?

chrome valve
#

you can read it sure but can't crate a button from it check the above bot command for more info

pseudo frost
#

What you want to do is impossible

#

i'll save you the read of !clickable

stuck mantle
#

Alright, thanks for the feedback. What's the best way to read that value?

#

Even if I can't update the value while in combat

pseudo frost
#

"the number of healing spells active in my group"?

stuck mantle
#

I wanted to make it broad, but I am getting the %unitCount of Renewing Mists in my group, and the %unitName of the unit with the least time remaining

pseudo frost
#

I don't understand what you want

stuck mantle
#

I would like to get the value of %unitName (which should be the unit with the least remaining buff time) via lua so that I can use this value in a custom function

pseudo frost
#

aura trigger, smart group, name of buff, don't auto-clone, match count > 0, lowest remaining time first

#

%unitName in display

#

but your question sound like you ignore we told you it's not possible and want to try it by yourself

stuck mantle
#

Not ignore what you just told me. I understand that it is not be possible and appreciate the guidance

#

But it would be great if you could also share how to get that information from the trigger.

#

It's certainly there for the WeakAuras API to use in the display section (as text), so my guess is that this is also available to use in code

pseudo frost
#

![help]

boreal nightBOT
#

Click [help] on any expanded code block to get information specific to that block's usage, including any args sent in, and any expected returns.

stuck mantle
#

I understand what I am trying to achieve is not doable. But learning how to fetch trigger information would be useful for other purposes

#

Sorry... I am not following where I am supposed to click help

#

The addon, discord?

pseudo frost
#

in the code editor where you want use it

stuck mantle
#

Thanks

#

So something like

function(states)
  return states[1].unitName
end

is what I was looking for