Take the 2-minute tour ×

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.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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:

/click [button:1] MultiBarLeftButton2; MultiBarLeftButton3

Then make two macros for each separate thing and put them on the proper button location. So, for the left click:

/csay 4 yourmessage
/csay 7 yourmessage

and right click:

/csay 1 yourmessage

If your message is too long to fit, you should be able to use semicolons to keep it all on one line:

/csay 4 yourmessage; 7 yourmessage

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:

ActionButton#                Main Bar*
MultiBarBottomLeftButton#    Bottom Left Bar
MultiBarBottomRightButton#   Bottom Right Bar
MultiBarRightButton#         Right Bar
PetActionButton#             Pet Bar

Here's a quick reference on branching with /click.

share|improve this answer

Your Answer


