Well I am unable to get my addon to do anything with events...
warcraftlab.toc
Code:
## Interface: 20100
## Author: Ankoku
## Title: |cFF0099FFWarcraftLab |r|cff00aa000.1a|r
## Notes: |cFF0099FFWarcraftLab|r quests/game data collection module.
## OptionalDeps:
## Dependencies:
## SavedVariables: _warcraftlabConfig
## SavedVariablesPerCharacter: _warcraftlabQuests _warcraftlabItems
warcraftlab.xml
warcraftlab.xml
Code:
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="warcraftlab.lua"/>
<Frame name="warcraftlab_MainFrame" hidden="true">
<Scripts>
<OnLoad>
WarcraftLab_OnLoad();
</OnLoad>
<OnEvent>
WarcraftLab_OnEvent();
</OnEvent>
</Scripts>
</Frame>
</Ui>
warcraftlab.lua
Code:
--[[ Varibles ]]--
warcraftlab = {};
warcraftlab.version = "0.1a";
--[[ Saved Variable Defaults (Note: All saved vars start with a _) ]]--
_warcraftlabConfig = {};
_warcraftlabConfig.enabled = true;
--[[ SLASH COMMANDS ]]--
SLASH_WARCRAFTLAB1 = "/wl";
SLASH_WARCRAFTLAB2 = "/warcraftlab";
SlashCmdList["WARCRAFTLAB"] = function(msg)
local tag = string.lower(msg);
if(msg == "status") then
if(_warcraftlabConfig.enabled == true) then
WarcraftLab_AddChat("Status: |cFF00FF00Enabled", "FFFFFF");
else
WarcraftLab_AddChat("Status: |cFFFF0000Disabled", "FFFFFF");
end
elseif(msg == "enable") then
if(_warcraftlabConfig.enabled == true) then
WarcraftLab_Error("Module is already enabled!");
else
_warcraftlabConfig.enabled = true;
WarcraftLab_AddChat("Module is now [ |cFF00FF00Enabled |cFFFFFFFFF].", "FFFFFF");
end
elseif(msg == "disable") then
if(_warcraftlabConfig.enabled == false) then
WarcraftLab_Error("Module is already disabled!");
else
_warcraftlabConfig.enabled = false;
WarcraftLab_AddChat("Module is now [ |cFFFF0000Disabled |cFFFFFFFFF].", "FFFFFF");
end
elseif(msg == "register") then
WarcraftLab_Register();
else
WarcraftLab_AddChat("Commands: status, enable, disable.", "FFFFFF");
end
end
--[[ TEST FUNCTION: RegisterEvent(WARCRAFTLAB_LOADED) ]]--
function WarcraftLab_Register()
this:RegisterEvent("WARCRAFTLAB_LOADED");
WarcraftLab_Debug("RegisterEvent: WARCRAFTLAB_LOADED");
end
--[[ OnLoad Function - Runs when the mod is loaded ]]--
function WarcraftLab_OnLoad()
this:RegisterEvent("WARCRAFTLAB_LOADED");
local info = ChatTypeInfo["SYSTEM"];
WarcraftLab_AddChat("Module Loaded.", "FFFFFF")
end
--[[ AddChat Function - Easily adds dialog to the client's main chat frame ]]--
function WarcraftLab_AddChat(msg, color)
local info = ChatTypeInfo["SYSTEM"];
ChatFrame1:AddMessage("|cFF0099FFWarcraftLab|r - |cFF" .. color .. msg, info.r, info.g, info.b, info.id);
end
--[[ Debug Function - Easily adds debug information to the client's main chat frame ]]--
function WarcraftLab_Debug(msg)
local info = ChatTypeInfo["SYSTEM"];
ChatFrame1:AddMessage("|cFF0099FFWarcraftLab|r - |cFF3C3C3C[DEBUG]:|r |cFFFFFFFF" .. msg, info.r, info.g, info.b, info.id);
end
--[[ Error Function - Easily adds a "plesent" error message to the client's main chat frame ]]--
function WarcraftLab_Error(msg)
local info = ChatTypeInfo["SYSTEM"];
ChatFrame1:AddMessage("|cFF0099FFWarcraftLab|r - |cFFFF0000[ERROR]: |r |cFFFFFFFF" .. msg, info.r, info.g, info.b, info.id);
end
--[[ OnEvent Function - This function handles all events ]] --
function WarcraftLab_OnEvent()
WarcraftLab_Debug("event::" .. event);
WarcraftLab_Debug("arg1::" .. arg1);
if(event == "WARCRAFTLAB_LOADED") then
local status;
if(_warcraftlabConfig.enabled == true) then
status = "|cFF00FF00Enabled|r";
else
status = "|cFFFF0000Disabled|r";
end
WarcraftLab_AddChat("Data Collection Module is currently [ " .. _warcraftlab_config.enabled .. " |cFFFFFFFF].|r", "FFFFFF");
end
end