Need help with secure button for aura

Hi, I’ve made an aura with saved formations to send missions instead of waiting 2~7mins so venture plan can calculate odds and sometimes have bad results that needs fixing …

The point is the aura can send the missions by itself, which is BAD to my point of view and already reported.
So I want to add a secure button that only sends the mission when I click the button, it can be either a click on icon or a press of a specific button, as long as the hardware event is sent along so that WoW sees it as being done.
I have a fair experience with auras but never touched secure buttons, so far I’ve found this, which is a reuse of a securebutton of a spell casting I’ve found here in the forum
aura_env.button = CreateFrame(“Button”, “SendMission”, WeakAuras.regions[aura_env.id].region, “SecureActionButtonTemplate”)
aura_env.button:SetAllPoints(WeakAuras.regions[aura_env.id].region)

aura_env.button:Show()
aura_env.button:SetAttribute(“type”, “macro”) --would type be macro?
aura_env.button:SetAttribute(“macro”, “/run C_Garrison.StartMission(missionID):onclick” )

I’m really lost here.

aura_env.button = CreateFrame(“Button”, “SendMission”, WeakAuras.regions[aura_env.id].region, “SecureActionButtonTemplate”)

Create a button named “SendMission” (not a great name) that is parented to the WeakAuras.regions[aura_env.id].region frame and inherits the “SecureActionButtonTemplate” (the template does not contain anything that is visible on-screen so you would need to add textures/texts etc.)

aura_env.button:SetAllPoints(WeakAuras.regions[aura_env.id].region)
Make it the same size/shape and location as the WeakAuras.regions[aura_env.id].region frame.

aura_env.button:Show()
Show the frame (not really needed as all frames are shown by default (and the frame doesn’t contain anything visible so…))

aura_env.button:SetAttribute(“type”, “macro”)
Make it a macro type action button designed to run macros instead of say casting a spell.

aura_env.button:SetAttribute(“macro”, “/run C_Garrison.StartMission(missionID):onclick” )
The macro to run when the button is clicked.

If you changed the first aura_env.button to local f and the others to just f you could reference the button without WeakAuras.

If you changed WeakAuras.regions[aura_env.id].region to UIParent you also wouldn’t need WA.

If you changed SetAllPoints(WeakAuras.regions[aura_env.id].region) to SetPoint("CENTER") the button would appear in the center of your screen.

If you made “SecureActionButtonTemplate” into “SecureActionButtonTemplate, ActionButtonTemplate” you would have a button that looked like as normal empty action button that you could add an icon to etc.

The code becomes something like (for a standalone secure action button, no WA required):

local f = CreateFrame("Button", "RuanxSendMission", UIParent, "SecureActionButtonTemplate, ActionButtonTemplate")
f:SetPoint("CENTER")
f:SetSize(32, 32)
f.icon:SetTexture("Interface\\PetBattles\\MountJournalEmptyIcon"); -- random icon to just see the button
f:SetAttribute("type", "macro")
f:SetAttribute("macro", "/run C_Garrison.StartMission(missionID):onclick" )

You could copy/paste the above to the website addon.bool.no to create/download a small addon to play with (clicking the button won’t do anything bacause at least it would need the garrison UI open and a vaild missionID supplied but you can change the macro text to any valid macro and try it.

You can change the location of the button on-screen by changing the SetPoint(…)

The code you posted is presumably from someone using WA to create a button (also presumably with an icon etc.) then using it’s OnLoad code (or whatever WA calls it) to create the secure macro button and position it transparently over the WA button.

2 Likes