PDA

View Full Version : SlashCmdList


unsane1
11-29-2004, 04:12 PM
Anyone have any hints on how this works? I see stuff like:

SlashCmdList["KILLCOUNT"] = KillCount_Print;
SLASH_KILLCOUNT1 = "/kill";

Is it something where basically you are registering a key for your addon in the SlashCmdList array, and WoW runs through and registers anything with SLASH_KEYNAMEKEYCOUNT? What importance does the function have as the value in that SlashCmdList array?

So, basically I should just use (ignoring cosmos for now):

SlashCmdList["MYNAME"] = "Any message I want?";
SLASH_MYNAME1 = "/start";
SLASH_MYNAME2 = "/stop";

Thanks for any leads, if this is documented somewhere, please feel free to just point me there, I haven't dug anything up on it yet.

unsane1
11-29-2004, 04:40 PM
Possibly answering some of my own questions...

instead of:
SlashCmdList["MYNAME"] = "Any message I want?";

I should actually give a callback function that I want to be called when one of my slash commands is actually called I am guessing? So it should be more like:

SlashCmdList["MYNAME"] = My_SlashCmd_Handler(msg);

Yes? No? Maybe?

sarf
11-29-2004, 04:41 PM
Actually, what you do is :

SlashCmdList["MYCOMMAND"] = MYCOMMAND_function;
SLASH_MYCOMMAND1 = "/mycommand";

It's not documented yet because documentation is boring.

Sarf
---
Reality is a nice place, but I wouldn't want to live there.

unsane1
11-29-2004, 05:03 PM
Cool, I'm getting this...

So can you really only have one slash command per addon? It seems like you can have multiple aliases, but no way to determine what slash command was actually used.

So, instead of:
/my_start
/my_end
/my_echo

It would be more like:
/my_command start
/my_command echo
/my_command end

Right? Not a huge limitation, but just thought I would check.

sarf
11-29-2004, 05:09 PM
Nono.

You can do :

SlashCmdList["MYCOMMAND"] = MYCOMMAND_function;
SLASH_MYCOMMAND1 = "/mycommand";

SlashCmdList["MYCOMMANDQWE"] = MYCOMMANDQWE_function;
SLASH_MYCOMMANDQWE1 = "/snorf";

SlashCmdList["SPEX"] = SPEX_function;
SLASH_SPEX1 = "/mupp";

However, it is recommend to keep down the number of slash commands (I personally have a tendency to go overboard).

Sarf
---
It is my firm belief that it is a mistake to hold firm beliefs.

unsane1
11-29-2004, 06:19 PM
Awesome!

Thank you very much. This is my initial foray into ui mods for WoW, so if anyone feels the pain of the slash commands, it'll just be me. I'll throw a UI on it once I learn that stuff, but I'm more interested in getting the functionality in place first.

Thanks again!