Thread Tools Display Modes
05-02-20, 11:31 PM   #1
save-disk
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Feb 2020
Posts: 9
Addon help for a newbie

Hey there! I'm making a little homebrew addon for just my friends and I that reminds you to refresh a particular buff before it runs out. I have a basic understanding of coding but im not really a coder so forgive if it's a pretty basic question.

I've got most of it working but the part of it that's confusing me is this: When you get a popup ingame that warns you your buffs about to run out, you can press refresh or cancel - when pressing refresh I need it to cast that particular spell (reflecting prism) on a party target. As far as my understanding goes, I need the safe button template to access the macro or use item/spell commands, but how to use that in the context of this popup window I just can't figure out.

An example of this is CrossRP, which allows users to refresh their elixir of tongues once receiving the warning it's about to run out. I read through the code for this extension but it just looked like magic to me.

Would someone mind explaining in simple terms how this works? Thank you very much for your time.
  Reply With Quote
05-03-20, 06:25 AM   #2
Vampyr78
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: May 2016
Posts: 10
When you create a button the last argument in the CreateFrame function is a template. You need to put there "SecureActionButtonTemplate". Here is an example:

Code:
button = CreateFrame("BUTTON", name, parent, "SecureActionButtonTemplate")
Then you can use SetAttribute to set specific attributes of this templete. This allows you to decide what kind of actoin or spell will be assigned to the button. For your purpose you can use "spell" attribute:

Code:
button:SetAttribute("type", "spell")
button:SetAttribute("spell", spellname)
You check more, including various attributes, here: https://wow.gamepedia.com/SecureActionButtonTemplate
  Reply With Quote
05-03-20, 12:38 PM   #3
save-disk
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Feb 2020
Posts: 9
Thank you for your help, it's appreciated! I managed to get as far as that- but how do I make it so it's the same button as the one on the popup window? (like when you accept or reject a summon)
  Reply With Quote
05-03-20, 02:11 PM   #4
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
A red button ?

Look at the Blizzard code for one of the frames that has it, I suspect it is one of the UI or options buttons.

Blizzard code is here if you weren't aware: https://www.townlong-yak.com/framexml/live

One example to look at is : UIPanelButtonNoTooltipTemplate

xml code at : https://www.townlong-yak.com/framexm...plates.xml#271

If not a red button maybe a screenshot or another permanent button that doesn't rely on a summons to see what you are talking about

The PetBattleQueueReady popup window ( code here: https://www.townlong-yak.com/framexm...pupSpecial.xml ) has the following button used.

UIPanelButtonTemplate
https://www.townlong-yak.com/framexm...plates.xml#312
__________________

Last edited by Xrystal : 05-03-20 at 02:14 PM.
  Reply With Quote
05-04-20, 04:43 AM   #5
save-disk
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Feb 2020
Posts: 9
Thank you for your help, both of you! I ended up going a different approach as a workaround and managed to get things working The links were handy though, wow's documentation is very scattered and fiddly.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Addon help for a newbie

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