Thread Tools Display Modes
03-14-19, 06:28 PM   #1
jlrm365
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2007
Posts: 113
Buff check

Hello.
I'm not a coder, but I hope I understand the simplicity of the "if... then... else..." patterns behind much of the LUA coding I've looked at.
After a bit of research, it seems that a MACRO can't perform an action on the absence or presence of a buff.

Decursive, however, seems to strike a nice balance. It checks for a debuff and then lets you click to perform an action to remove it.
That would suggest that, even if it cannot perform a direct action, LUA can check for the presence of a debuff. It seems, then, that it could also check for buffs.

What I'd hoped would be possible would be to check for the presence of a buff on a pet and then tell me when it's no longer there.

Can simple LUA do that and tell me in chat (for my eyes only, as I'd hate to spam everyone) if it's not there / when it drops off?
If you're able to throw that together, then great. If not, then I'd appreciate being pointed at a resource that would show me how it could be done.

Much appreciated.
  Reply With Quote
03-14-19, 06:44 PM   #2
Tim
A Rage Talon Dragon Guard
 
Tim's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 308
Yes you can do it with Lua but, since you really have no clue what you're doing there's definitely an alternate solution and mind you a much simpler one called WeakAuras.

1) Install WeakAuras and type /wa to open it
2) Click on New at the top of the left side and then Icon on the right side
3) On the right side click on the Trigger tab
4) Go down to the Unit dropdown box and select Pet
5) Check the box Exact Spell ID(s) and input the id of the buff you're trying to track

That is a basic icon to show X buff when it's present. There's more options to get fancier, etc. but, that's up to you to delve into.
__________________
AddOns: Tim @ WoWInterface
Characters: Mage, Priest, Devoker, Pally
Battle Tag: Mysterio#11164
Current PC Setup: PCPartPicker List
  Reply With Quote
03-14-19, 09:18 PM   #3
jlrm365
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2007
Posts: 113
Thumbs up Much appreciated

That certainly does do the trick, but I wondered if I could do a bit more with it. Delve I have (started to).
I'm certainly able to learn programming languages, but the game takes enough time as it is and so I'm pleased with how well WeakAuras was able to fill my niche "need".
You don't need to read on, but I thought you might like to know that your words were not ignored.


What I wanted was to have the button appear when the buff was NOT there, so I'd be reminded to renew it.
Further down the "Trigger" tab, it was easy enough to change "Show On" to "Aura(s) Missing."
That then meant that the icon would be present when the buff wasn't and vice versa, which is just what I wanted.

The icon's behaviour seemed a bit spartan, though, so I thought I'd smarten it up. Sure enough, I was able to add some (On Show) Actions:
  • Chat Message (Message Type: Chat Frame, Message: "Use [item]!")
  • Play Sound: Bike Horn

The icon defaults to the middle of the screen, which could be a problem for some, but I had long ago repositioned my player and target frames (manually, within the "layout-local" files).
By coincidence, the icon's top lines up (to the pixel) with the tops of those frames. I'm not OCD but, as the icon is also equidistant between those two frames, that makes for nice symmetry.
No need to tweak the Display:Position Settings at all.

It's an addon that I've known about for a while, but that I thought I'd never have a use for. My use is still going to remain limited, but the specific thing I'm using it for makes it a great quality of (game) life boost. A macro with a modifier, to make casting the buff item even easier, should be the cherry on top.
I'll look into doing some more with WeakAuras, at some point (There must be some "Top 10 Cool Tricks"-type videos online), but I'm happy enough for now.


Much appreciated.
  Reply With Quote
03-11-20, 02:48 AM   #4
Narfi
A Murloc Raider
Join Date: Jan 2020
Posts: 7
Hey,

little bit older but perhaps you or anyone else need it anyway.
The easiest way I find for myself is:

Code:
local f = CreateFrame('Frame')
f:RegisterEvent("UNIT_AURA")

f:SetScript("OnEvent", function(_, event, ...)
        if not (AuraUtil.FindAuraByName('YOURBUFFNAME', "player", "HELPFUL")) then
		RaidNotice_AddMessage(RaidWarningFrame," spotted!", ChatTypeInfo["RAID_WARNING"])
  		end
end)



Cheers
Narfi

PS: Don't have a clue what im doing, just a try and error thing and I hate big complicated codes
  Reply With Quote
03-11-20, 05:42 PM   #5
jlrm365
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2007
Posts: 113
Thumbs up

Thanks for the information. It's no longer a concern, but I'll bookmark that post for future reference.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Buff check

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