Quantcast
Can 1 actionButton have 2 macros? - WoWInterface
Thread Tools Display Modes
08-01-15, 10:13 AM   #1
Spawnova
A Warpwood Thunder Caller
 
Spawnova's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2012
Posts: 96
Can 1 ActionButton have 2 macros attributes?

I have some code to make many actionButton and 1 of the buttons has to have 2 macros, 1 for shift left click and another for right click, but whenever I shift left click, it always executes the macro of right click.

Here is my code:

Lua Code:
  1. if toyList[i].type2 then  --if there is a macro for right click, set it
  2.     btn:SetAttribute("type2", "macro");
  3.     btn:SetAttribute("macrotext", toyList[i].type2);
  4. end
  5. if toyList[i].stype1 then --if there is a macro for shift+left click, set it
  6.     print(toyList[i].stype1)
  7.     btn:SetAttribute("shift-type1", "macro");
  8.     btn:SetAttribute("macro1", toyList[i].stype1);
  9. end
Any help would be great =)

Last edited by Spawnova : 08-01-15 at 10:19 AM.
  Reply With Quote
08-01-15, 11:20 AM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,794
What are the contents of the macros? Is there a reason why they can't just be one macro with conditionals?
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
08-01-15, 01:33 PM   #3
Spawnova
A Warpwood Thunder Caller
 
Spawnova's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2012
Posts: 96
Right click runs a script to show one of my windows, shift left click cast's a macro that can't be done otherwise.

shift-type1 = MACRO_NAME --
type2 = "/script ToggleShinsPetWindow()"

Last edited by Spawnova : 08-01-15 at 01:45 PM.
  Reply With Quote
08-02-15, 11:47 PM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
I believe the "macrotext" in this line:
Code:
    btn:SetAttribute("macrotext", toyList[i].type2);
... should be "macrotext2" instead, but I haven't really looked at or thought about any WoW API stuff in months, so I could be wrong.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Donít message me about addon bugs or programming questions.
  Reply With Quote
08-03-15, 04:42 PM   #5
Spawnova
A Warpwood Thunder Caller
 
Spawnova's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2012
Posts: 96
Originally Posted by Phanx View Post
I believe the "macrotext" in this line:
Code:
    btn:SetAttribute("macrotext", toyList[i].type2);
... should be "macrotext2" instead, but I haven't really looked at or thought about any WoW API stuff in months, so I could be wrong.
I'm not sure, I eventually just removed the original left click attribute and replaced it with one of my macros and it works fine, I think it had something to do with the key modifiers. Thanks for the help =P
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Can 1 actionButton have 2 macros?

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