I've been trying to make a mod that simply detects when the player "Darkbane" dies... I really cant find what is wrong with it to tell you the truth and it would be nice if someone could give me a heads up.
---------------------------------------------------------
function DbCaller_println( Message)
DEFAULT_CHAT_FRAME:AddMessage(Message, 1, 1, 1);
end
DbCaller_Enabled = true;
DbCaller_Deaths = 0;
function DbCaller_Init()
SLASH_DBCALLER1 = "/dbcaller";
SlashCmdList["DBCALLER"] = function(msg)
DbCaller_Commands(msg);
end
end
function DbCaller_Commands(msg)
if( msg ) then
local command = string.lower(msg);
if( command == "" ) then
DbCaller_println("/DbCaller");
DbCaller_println(" status Displays Darkbane Caller status.");
DbCaller_println(" toggle Toggle Darkbane Caller on and off.");
DbCaller_println(" reset Resets Darkbane's death count.");
elseif (command == "status" ) then
DbCaller_Status();
elseif (command == "toggle" ) then
DbCaller_Toggle();
elseif (command == "reset" ) then
DbCaller_Reset();
end
end
end
function DbCaller_Status()
DbCaller_println("Darkbane Caller Alpha");
if (DbCaller_Enabled) then
DbCaller_println( " Darkbane Caller enabled.")
DbCaller_println( " Darkbane has died "..DbCaller_Deaths.." times.")
else
DbCaller_println( " Darkbane Caller disabled.")
end
end
function DbCaller_Toggle()
if (DbCaller_Enabled) then
DbCaller_println( "Darkbane Caller disabled.")
DbCaller_Enabled = false;
else
DbCaller_println( "Darkbane Caller enabled.")
DbCaller_Enabled = true;
end
end
function DbCaller_Reset()
if (DbCaller_Enabled) then
DbCaller_println( "Darkbane's death count set to 0.")
DbCaller_Deaths = 0;
end
end
function DbCaller_Count()
if (DbCaller_Enabled) then
string.find(arg1, "Darkbane dies") then
DbCaller_Deaths = DbCaller_Deaths + 1;
SendChatMessage("Darkbane has died "..DbCaller_Deaths.." times.", "RAID");
end
end
---------------------------------------------
and my xml...
---------------------------------------------
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
<Script file="DbCaller.lua"/>
<Frame name="DbCaller">
<Scripts>
<OnLoad>
this:RegisterEvent("VARIABLES_LOADED");
this:RegisterEvent("CHAT_MSG_COMBAT_FRIENDLY_DEATH");
</OnLoad>
<OnEvent>
if (event == "VARIABLES_LOADED") then
DbCaller_Init();
elseif (event == "CHAT_MSG_COMBAT_FRIENDLY_DEATH") then
DbCaller_Count();
end
</OnEvent>
</Scripts>
</Frame>
</Ui>