Recent changes Random page
GAMING
Gaming
 
StarCraft Wiki
Super Smash Wiki
Halopedia
Diablo Wiki
FFXIclopedia
Grand Theft Wiki
See more...

Talk:Creating a slash command

From WoWWiki

Jump to: navigation, search

I can't do it!!!!

Ok, I'm starting work on a simple test addon as a way to get to grips with lua and xml and the other aspects of coding. I've been using WoW UI Designer for it, largely because it's all I have, and I'm not confident enough to hard-code with notepad just yet! Anyway, I want to create a /easyinfo slash command to show the basic UI element of the project (EasyinfoForm), so I did this:

function Easyinfo_OnLoad()
SLASH_EASYINFO1 = "/easyinfo";
SLASH_EASYINFO2 = "/ezi";
SlashCmdList["MYSCRIPT"] = EasyinfoForm:Show();
end

All that happens when I type /easyinfo or /ezi in on wow is that it comes up with a "type /help for a few commands" thing in the console... my command isn't recognised.

I have loaded the addon, it has a current UI number and I didn't typo the command (I tried several times each time I altered the code, embarrasingly it was throwing up an error to begin with because I had put in "Easyinfo_Onload();" instead of "Easyinfo_Onload()")

Thanks in advance. -- Yoda  talk / cont 13:21, 23 March 2007 (EDT)

Hey Yoda. Two things. Change:
SlashCmdList["MYSCRIPT"] = EasyinfoForm:Show();
to
SlashCmdList["EASYINFO"] = EasyinfoForm:Show;
I was tripped up with mine own setup like this. If you say " = function()" instead of " = function", the LUA engine sets the SlashCmdList for your :addon to the function's RESULT rather than name.
Hope that helps. Rihlsul 20:04, 12 April 2007 (EDT)