With the death of extended macros in TWW, I’m looking to transfer a lengthy macro into an addon to do the same thing. Nothing super fancy, just a non-combat helper macro that unfortunately requires a lot of characters.
Anyone have a simple block of lua for an addon to basically execute its code upon pressing a particular keyboard button?
Depending on the code, it’s probably easier to put your code into a unique global function as an addon an just /run
that from the macro.
I use this for my worldmarker spam macro.
https://wago.io/WLcXW-0JN
Haven’t tested it in prepatch.
I see. So I put my code into one of my simpler existing addons like this:
function GavMacroCode()
[my code]
end
Then in game, made a macro that says /run GavMacroCode. Nothing seems to happen, but no errors. I’m sure I’m doing something wrong. Any advice?
Looks like the new /click
limitations have broken my implementation.
Ive been trying to find where these limitation are spelled out. So far, all I have come across is this: https://warcraft.wiki.gg/wiki/Patch_11.0.0/API_changes#Click_events
It’s not “spelled out” but you can see some author discussion around it that worked it’s way through the Beta process.
https://github.com/Stanzilla/WoWUIBugs/issues/552
1 Like
A word of caution, a function created like this is global so make sure you use a unique name. You have but I thought is was worth pointing out.
Second if you want more functions you can limit that by putting your functions in a table like this
GavMacroCode = {}
function GavMacroCode:function1()
//Code
end
function GavMacroCode:function2()
//Code
end
then you can call it with
/run GavMacroCode:function1()
and
/run GavMacroCode:function2()
This will give you as many functions you need but only one global variable.
1 Like