WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Can 1 actionButton have 2 macros? (https://www.wowinterface.com/forums/showthread.php?t=52565)

Spawnova 08-01-15 10:13 AM

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 =)

Seerah 08-01-15 11:20 AM

What are the contents of the macros? Is there a reason why they can't just be one macro with conditionals?

Spawnova 08-01-15 01:33 PM

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()"

Phanx 08-02-15 11:47 PM

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.

Spawnova 08-03-15 04:42 PM

Quote:

Originally Posted by Phanx (Post 310082)
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


All times are GMT -6. The time now is 08:36 AM.

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