WeakAuras 2 button with macro
Hi all
I'm trying to program a button to run a simple macro with a /script command, but it doesn't work. The code works if I just set the macrotext to "/sit". I will post two examples to show what I mean Example 1: f.button = CreateFrame("Button", nil, f,"SecureActionButtonTemplate") f.button:SetAttribute("type","macro") local macrotext = "/sit" f.button:SetAttribute("macrotext",macrotext) Example 2: f.button = CreateFrame("Button", nil, f,"SecureActionButtonTemplate") f.button:SetAttribute("type","macro") local macrotext = "/script SetLootMethod("group")" f.button:SetAttribute("macrotext",macrotext) In this case, example 1 works fine, but example 2 does not change to group loot, even though the macro text works if I save it as a macro and run it. Is this due to some limitation in the API? And is there any other way to program the button to perform this action without setting the type as macro if so? Thanks for any help |
Enable Lua errors:
Code:
/console scriptErrors 1 Therfore in example 2 your macrotext is cut off. If you want to use special characters inside a string you must escape them. Code:
local macrotext = "/script SetLootMethod(\"group\")" |
Thanks very much for the help, I tried it out and everything seems to work now
|
Or you can use single apostrophes.
Lua Code:
----------- (Example of what Urtgard was telling you:) Lua Code:
|
All times are GMT -6. The time now is 11:27 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI