I want to broadcast a message throughout several channels. When left click, broadcasting to all channels, when right click, just to channel 1. This is my original script, though it exceeds the character limits of a macro. How can I make it shorter?
/run s="a long long long long .... message ..."
/script SendChatMessage(s ,"CHANNEL" , "COMMON" ,"1");
/script if(GetMouseButtonClicked()=="LeftButton") then SendChatMessage(s ,"CHANNEL" , "COMMON" ,"4") end;
/script if(GetMouseButtonClicked()=="LeftButton") then SendChatMessage(s ,"CHANNEL" , "COMMON" ,"7") end;
I was looking for how to use "for each (4,7)
" to replace the last 2 lines, but didn't find a "for each
" syntax for WoW API.
Best Answer
For each exists, but only if you create an array first, which isn't helpful. I can't log in to check right now, but you can try something like this:
Make one macro that makes it act like you clicked on a button and reroutes to another based on right/left click:
Then make two macros for each separate thing and put them on the proper button location. So, for the left click:
and right click:
If your message is too long to fit, you should be able to use semicolons to keep it all on one line:
Or, you can do part of it, and put
/click MultiBarLeftButton4
to chain it to another button with the rest of the message.For reference, here's the different action bar names:
Here's a quick reference on branching with /click.