Thread Tools Display Modes
02-04-06, 02:01 PM   #1
Forestwind
A Kobold Labourer
Join Date: Feb 2006
Posts: 1
Debug request :/

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>

Last edited by Forestwind : 02-04-06 at 02:16 PM.
  Reply With Quote
02-26-06, 08:19 AM   #2
Wobin
An Aku'mai Servant
 
Wobin's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 35
I'm assuming that the line:

Code:
string.find(arg1, "Darkbane dies") then
is just typoed without the 'if' here...but, where are you having problems? Is it not loading? Is it not calling the function on event? Can you call each function manually and have them work?
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Debug request :/

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