View Single Post
09-30-07, 07:40 AM   #1
iowa
A Murloc Raider
Join Date: Sep 2007
Posts: 6
Parse a command out

Hello all,

Sorry for my poor english but I'm french.
I want parse a command out, My command is like :

aaaaaa 18 eeeee
And I want find "18".
Maybe a hook is a good solution, i writed this :

[code]
----------------------------------------------------------------
-- Variables
----------------------------------------------------------------
local filtre = "false";

----------------------------------------------------------------
-- Evenement chargement
----------------------------------------------------------------
function GmTool_OnLoad()
-- Crée la slash command
SlashCmdList["GMTOOL"] = GmTool_perso_Slash;
SLASH_GMTOOL1 = "/gt";
end

----------------------------------------------------------------
-- Evenement d'appel de /gt
----------------------------------------------------------------
function GmTool_perso_Slash(cmd)
DEFAULT_CHAT_FRAME:AddMessage("Command: " .. cmd);

if cmd == "dtoff" then
-- Met en place le Hook
GmTool_HookAllChatFrames();

-- Met en place l'indicateur de filtre
filtre = "true";
end

end

----------------------------------------------------------------
-- Hook
----------------------------------------------------------------
function GmTool_HookAllChatFrames()
for i=1,NUM_CHAT_WINDOWS do
local cf = getglobal("ChatFrame"..i);
cf.GmTool_Orig_AddMessage = cf.AddMessage;
cf.AddMessage = GmTool_ChatFrame_AddMessage;
end
end

function GmTool_ChatFrame_AddMessage(self, msg)
if msg == "Command: test" then
DEFAULT_CHAT_FRAME:AddMessage(msg);
DEFAULT_CHAT_FRAME:AddMessage(self);
end
end

[/quote]

But it's not good
Thank's for your help.