WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Addon help for a newbie (https://www.wowinterface.com/forums/showthread.php?t=57976)

save-disk 05-02-20 11:31 PM

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.

Vampyr78 05-03-20 06:25 AM

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

save-disk 05-03-20 12:38 PM

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)

Xrystal 05-03-20 02:11 PM

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

save-disk 05-04-20 04:43 AM

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.


All times are GMT -6. The time now is 05:03 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI