WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Slashcommandhandler (https://www.wowinterface.com/forums/showthread.php?t=18070)

TreeBee 09-06-08 07:22 AM

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

Zirconium176 09-06-08 07:33 AM

/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?

Tristanian 09-06-08 08:50 AM

Quote:

Originally Posted by TreeBee (Post 101476)
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 ?

TreeBee 09-06-08 10:17 AM

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. :D

Tristanian 09-06-08 10:26 AM

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

TreeBee 09-06-08 10:38 AM

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?

TreeBee 09-06-08 10:54 AM

found it... apparently in WoW UI Designer Function is not the same as function.

:D :banana:

Thanks for the assist! (many more questions to come! :D )


All times are GMT -6. The time now is 12:11 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI