PDA

View Full Version : How to execute a slash-cd ?


zaxya
08-10-2006, 07:01 PM
Hello,

Sorry if it is a stupid question but I would like to execute a slash-command in a script and I don't know how this can be done.

I tried:

local myCommand = "/raresist";
RunScript(myCommand);
SendChatMessage(myCommand,"SAY");
SendChatMessage(myCommand,"EMOTE");
DoEmote(myCommand);
ConsoleExec(myCommand);

but nothing works :(

Thanks for youy help!

zaxya
11-10-2006, 11:36 AM
UP

I tried:

local myCommand = "/abs" -- test
if (not ChatFrameEditBox:IsVisible()) then
ChatFrame_OpenChat(myCommand );
else
ChatFrameEditBox:SetText(myCommand );
end;
ChatEdit_ParseText(ChatFrameEditBox,0);
ChatEdit_ParseText(ChatFrame1.editBox,0);
ChatEdit_OnEnterPressed();

but it returns me a framexml error :(

freeri
12-10-2006, 12:33 AM
It's not your Lua that executes a slash command, it is slash commands that executes Lua code.

A slash command often execute a function, you can just call that function with your Lua code.

Example if the slash command '/abs' execute a function called abs_func() .. Then just call the abs_func() function instead.

SendChatMessage do not execute scripts or slashcommands, it simply prints the argument out.