Thread Tools Display Modes
11-23-16, 01:41 AM   #1
MuffinManKen
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 106
Summoning Battle Pets from a Secure Button

Does anyone know what attributes to set on a SecureActionButton to summon a battle pet? I was sure I'd figured this out at one point, but when I went back to my notes and tested the code, it didn't work.

Code:
btn = CreateFrame("Button", "TestPet", UIParent, "SecureActionButtonTemplate,ActionButtonTemplate");
btn:SetAttribute("type", "summonpet");
btn:SetAttribute("summonpet", C_PetJournal.GetPetInfoByIndex(1));
btn:SetPoint("Center",UIParent)
I can't seem to find any documentation anywhere on what to set the "type" attribute to. GetActionInfo() helpfully tells me "summonpet" is a thing, but is that the type? It's own attribute? Both?
  Reply With Quote
11-23-16, 03:49 AM   #2
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Afaik, summoning pets can be done insecurely.
  Reply With Quote
11-23-16, 05:09 AM   #3
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
You could sift through PetLeash's code and see how they do it. I don't remember if it was PetLeash or another addon, but I remember in the past some pet addon piggybacked movement keys to get that hardware event to summon pets. PetLeash doesn't do that, pets are summoned standing still, but I don't recall any pets being summoned in combat, so not sure if it's secure or not.
  Reply With Quote
11-23-16, 09:58 AM   #4
MuffinManKen
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 106
Originally Posted by p3lim View Post
Afaik, summoning pets can be done insecurely.
It can, but this is for AutoBar where almost every button needs to be secure. Having a mix of secure and insecure buttons would add complexity that I'd rather avoid.
  Reply With Quote
11-23-16, 10:33 AM   #5
MuffinManKen
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 106
Originally Posted by Kanegasi View Post
You could sift through PetLeash's code and see how they do it. I don't remember if it was PetLeash or another addon, but I remember in the past some pet addon piggybacked movement keys to get that hardware event to summon pets. PetLeash doesn't do that, pets are summoned standing still, but I don't recall any pets being summoned in combat, so not sure if it's secure or not.
It probably isn't secure, but I'll take a look anyway.
  Reply With Quote
11-23-16, 10:34 AM   #6
MuffinManKen
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 106
If all else fails, I could hack it with macro/macrotext, but if it can be done simply by setting the appropriate attributes, I'd rather do it that way.
  Reply With Quote
11-23-16, 04:44 PM   #7
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by Kanegasi View Post
I don't remember if it was PetLeash or another addon, but I remember in the past some pet addon piggybacked movement keys to get that hardware event to summon pets.
Heh.
  Reply With Quote
11-23-16, 05:14 PM   #8
JDoubleU00
A Firelord
 
JDoubleU00's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 463
Originally Posted by p3lim View Post
I'm guessing that won't work anymore?
__________________
Author of JWExpBar and JWRepBar.
  Reply With Quote
11-23-16, 05:30 PM   #9
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by rocnroll View Post
I'm guessing that won't work anymore?
API has been completely rewritten twice since then, but feel free to try replacing the old calls with new ones and see if it works.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Summoning Battle Pets from a Secure Button


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