Thread Tools Display Modes
09-06-08, 07:22 AM   #1
TreeBee
A Murloc Raider
Join Date: Sep 2008
Posts: 7
Slashcommandhandler

Hi,

my code doesn't seem to work:

function MaggyAssigner_SlashHandler(msg)
local Cmd = MaggyAssigner_GetCmd(msg);
if (Cmd == "help") then
MaggyAssigner_DisplayHelp();
elseif (Cmd == "show") then
MaggyAssigner_DisplayMe();
else
MaggyAssigner_DisplayHelp();
end
end

function MaggyAssigner_DisplayMe()
MaggyAssigner:Show();
end

function Maggy_DisplayHelp()
DEFAULT_CHAT_FRAME:AddMessage("HELP!");
end

function MaggyAssigner_OnLoad()
SlashCmdList["MaggyAssigner"] = MaggyAssigner_SlashHandler(msg);
SLASH_MaggyAssigner1 = "/show";
SLASH_MaggyAssigner2 = "/help";
end

The form's onload event: MaggyAssigner_OnLoad();


What am I doing wrong?

rg,
Eric
  Reply With Quote
09-06-08, 07:33 AM   #2
Zirconium176
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 7
/help is used by the Blizzard UI. That may be part of it.
What kind of errors are you getting? Are your slash commands not being recognized?
  Reply With Quote
09-06-08, 08:50 AM   #3
Tristanian
Andúril
Premium Member
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 279
Originally Posted by TreeBee View Post
Hi,

my code doesn't seem to work:

function MaggyAssigner_SlashHandler(msg)
local Cmd = MaggyAssigner_GetCmd(msg);
if (Cmd == "help") then
MaggyAssigner_DisplayHelp();
elseif (Cmd == "show") then
MaggyAssigner_DisplayMe();
else
MaggyAssigner_DisplayHelp();
end
end

function MaggyAssigner_DisplayMe()
MaggyAssigner:Show();
end

function Maggy_DisplayHelp()
DEFAULT_CHAT_FRAME:AddMessage("HELP!");
end

function MaggyAssigner_OnLoad()
SlashCmdList["MaggyAssigner"] = MaggyAssigner_SlashHandler(msg);
SLASH_MaggyAssigner1 = "/show";
SLASH_MaggyAssigner2 = "/help";
end

The form's onload event: MaggyAssigner_OnLoad();


What am I doing wrong?

rg,
Eric
First of all try making SlashCmdList["MaggyAssigner"] = MaggyAssigner_SlashHandler(msg) to SlashCmdList["MaggyAssigner"] = MaggyAssigner_SlashHandler;

Secondly, where is this function (MaggyAssigner_GetCmd(msg)) and why are you calling it and not directly checking the msg argument ?
  Reply With Quote
09-06-08, 10:17 AM   #4
TreeBee
A Murloc Raider
Join Date: Sep 2008
Posts: 7
Ok, changed the code to:

function MaggyAssigner_SlashHandler(msg)
if (msg == "help") then
MaggyAssigner_DisplayHelp();
elseif (msg == "show") then
MaggyAssigner_DisplayMe();
else
MaggyAssigner_DisplayHelp();
end
end

function MaggyAssigner_DisplayMe()
MaggyAssigner:Show();
end

function Maggy_DisplayHelp()
DEFAULT_CHAT_FRAME:AddMessage("HELP!");
end

function MaggyAssigner_OnLoad()
SlashCmdList["MaggyAssigner"] = MaggyAssigner_SlashHandler();
SLASH_MaggyAssigner1 = "/show";
SLASH_MaggyAssigner2 = "/help";
end

As I understand it, I should get my frame visible with: /show
don't I?

As you can see I am very new to this.
  Reply With Quote
09-06-08, 10:26 AM   #5
Tristanian
Andúril
Premium Member
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 279
SlashCmdList["MaggyAssigner"] = MaggyAssigner_SlashHandler;

No '()'. Post if it works now, at least the slash commands should. The frame may (or may not) have other issues
  Reply With Quote
09-06-08, 10:38 AM   #6
TreeBee
A Murloc Raider
Join Date: Sep 2008
Posts: 7
I'm noticing that no function called by the form is working.

I have two buttons on my form.
One has in the OnClick event: Form_name:Hide();

If I change it to call a function in the lua file, nothing happens.

Do I have to 'connect' the lua file and form file somehow?
  Reply With Quote
09-06-08, 10:54 AM   #7
TreeBee
A Murloc Raider
Join Date: Sep 2008
Posts: 7
found it... apparently in WoW UI Designer Function is not the same as function.



Thanks for the assist! (many more questions to come! )
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Slashcommandhandler

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off