Thread Tools Display Modes
11-04-06, 11:54 AM   #1
Kaligar
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 7
Spells using a button

Anyone out the know exactly whats need to have a spell cast via a button while in combat?
Works fine out of combat and seems to work for removing aspects (which just requires a recast of the spell) but dosent seem to cast to apply the aspect.
I know it has something to do with secure frame and have looked in the original interface files and cant see anything in them that dif to what im doing.
Thanks
  Reply With Quote
11-04-06, 02:06 PM   #2
Nymbia
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 22
Originally Posted by Kaligar
Anyone out the know exactly whats need to have a spell cast via a button while in combat?
Works fine out of combat and seems to work for removing aspects (which just requires a recast of the spell) but dosent seem to cast to apply the aspect.
I know it has something to do with secure frame and have looked in the original interface files and cant see anything in them that dif to what im doing.
Thanks
There's some great example code in SecureTemplates.lua.

Code:
-- SecureActionButton
--
-- SecureActionButtons allow you to map different combinations of modifiers and buttons into
-- actions which are executed when the button is clicked.
--
-- For example, you could set up the button to respond to left clicks by targeting the focus:
-- self:SetAttribute("unit", "focus");
-- self:SetAttribute("type1", "target");
--
-- You could set up all other buttons to bring up a menu like this:
-- self:SetAttribute("type*", "menu");
-- self.showmenu = menufunc;
--
-- SecureActionButtons are also able to perform different actions depending on whether you can
-- attack the unit or assist the unit associated with the action button.  It does so by mapping
-- mouse buttons into "virtual buttons" based on the state of the unit. For example, you can use
-- the following to cast "Mind Blast" on a left click and "Shadow Word: Death" on a right click
-- if the unit can be attacked:
-- self:SetAttribute("harmbutton1", "nuke1");
-- self:SetAttribute("type-nuke1", "spell");
-- self:SetAttribute("spell-nuke1", "Mind Blast");
-- self:SetAttribute("harmbutton2", "nuke2");
-- self:SetAttribute("type-nuke2", "spell");
-- self:SetAttribute("spell-nuke2", "Shadow Word: Death");
--
-- In this example, we use the special attribute "harmbutton" which is used to map a virtual
-- button when the unit is attackable. We also have the attribute "helpbutton" which is used
-- when the unit can be assisted.
--
-- Although it may not be immediately obvious, we are able to use this new virtual button
-- to set up very complex click behaviors on buttons. For example, we can define a new "heal"
-- virtual button for all friendly left clicks, and then set the button to cast "Flash Heal"
-- on an unmodified left click and "Renew" on a ctrl left click:
-- self:SetAttribute("*helpbutton1", "heal");
-- self:SetAttribute("*type-heal", "spell");
-- self:SetAttribute("spell-heal", "Flash Heal");
-- self:SetAttribute("ctrl-spell-heal", "Renew");
--
-- This system is very powerful, and provides a good layer of abstraction for setting up
-- a button's click behaviors.
  Reply With Quote
12-02-06, 08:39 AM   #3
Saiiyna
An Aku'mai Servant
 
Saiiyna's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 33
That example is okay but it would be more helpful to me to see a complete code snipett where it actually works.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Spells using a 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