Ok, I've been working on this dang script for almost 2 days now, more often than not the script will throw the same 2 errors, but every once in a while it will run just fine.
The errors I am getting are:
- <string>:"Main:OnLoad":2: Attempt to call global 'Buah_Start' (a nil value)
- <string>:"Main:OnUpdate":1: Attempt to call global 'DKA' (a nil Value)
I just cannot seem to figure out what is cause the errors most of the time but not always. following is the source for both the xml and lua
.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="dkalerter.lua"/>
<Frame name="Buah_Red" toplevel="true" hidden="true" parent="UIParent">
<Size>
<AbsDimension x="2000" y="2000"/>
</Size>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentBackground" setAllPoints="true">
<Color r="1" g="0" b="0" a="0.4"/>
</Texture>
</Layer>
</Layers>
</Frame>
<Frame name="Buah_Blue" toplevel="true" hidden="true" parent="UIParent">
<Size>
<AbsDimension x="2000" y="2000"/>
</Size>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentBackground" setAllPoints="true">
<Color r="0" g="0" b="1" a="0.4"/>
</Texture>
</Layer>
</Layers>
</Frame>
<Frame name="Main" toplevel="true" hidden="false" parent="UIParent">
<Size>
<AbsDimension x="1" y="1"/>
</Size>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentBackground" setAllPoints="true">
<Color r="0" g="0" b="0" a="0"/>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnLoad>
self.TimeSinceLastUpdate = 0
Buah_Start()
</OnLoad>
<OnUpdate>
DKA()
Checker(self, elapsed)
</OnUpdate>
<OnEvent>
</OnEvent>
</Scripts>
</Frame>
</Ui>
.lua
Code:
Reset_Interval = 900.0
Seal_Interval = 0.2
local Sealinc = 0
local sound = 1
local flash = 1
local soundt = "|cff33ff99 on"
local flasht = "|cff33ff99 on"
function Checker(self, elapsed)
self.TimeSinceLastUpdate = self.TimeSinceLastUpdate + elapsed;
if (self.TimeSinceLastUpdate > Reset_Interval) then
self.TimeSinceLastUpdate = 0
end
end
function Buah_Start()
SLASH_BUAHALARM1 = "/dkalerter"
SLASH_BUAHALARM2 = "/dka"
SlashCmdList["BUAHALARM"] = Buahhelp
end
function Buahhelp(msg)
if (msg=="sound on") then
sound = 1
soundt = "|cff33ff99 On"
end
if (msg=="sound off") then
sound = 0
soundt = "|cff33ff99 Off"
end
if (msg=="flash on") then
flash = 0
flasht = "|cff33ff99 On"
end
if (msg=="flash off") then
flash = 0
flasht = "|cff33ff99 Off"
end
if (msg=="about") then
DEFAULT_CHAT_FRAME:AddMessage("|cffad081eDeathknight Alerter|cffffffff - Version 0.1 - Created November 18, 2008")
DEFAULT_CHAT_FRAME:AddMessage("Created By: |cff4cb3feFoxyknight|cffffffff - Dawnbreaker US")
DEFAULT_CHAT_FRAME:AddMessage("This addon currently only tracks the Freezing Fog and Sudden Death procs.")
if (msg=="") then
DEFAULT_CHAT_FRAME:AddMessage("Sound Control: /dkalerter sound on/off")
DEFAULT_CHAT_FRAME:AddMessage("Flash Control: /dkalerter flash on/off")
end
DEFAULT_CHAT_FRAME:AddMessage("Current Configurations: Sound="..soundt.."|cffffffff Flash="..flasht)
end
function DKA()
this:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
this:SetScript("OnEvent", function(self, event, ...)
local timestamp, eventType, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags = select(1)
local arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11 = select(9)
if eventType == "SPELL_AURA_APPLIED" then
if srcName == UnitName("player") then
if (arg2 == "Death Trance!" or "Freezing Fog") then
if (sound > 0) then
PlaySoundFile("Interface\\Addons\\dkalerter\\sounds\\warn.mp3")
end
if (flash > 0) then
if not self.FlashFrame then
local flasher = CreateFrame("Frame", "DKAFlashFrame")
flasher:SetToplevel(true)
flasher:SetFrameStrata("FULLSCREEN_DIALOG")
flasher:SetAllPoints(UIParent)
flasher:EnableMouse(false)
flasher:Hide()
flasher.texture = flasher.CreateTexture(nil, "BACKGROUND")
flasher.texture:SetTexture("Interface\\FullScreenTextures\\LowHealth")
flasher.texture:SetAllPoints(UIParent)
flasher.texture:SetBlendMode("ADD")
flasher:SetScript("OnShow", function(self)
self.elapsed = 0
self:SetAlpha(0)
end)
flasher:SetScript("OnUpdate", function(self, elapsed)
elapsed = self.elapsed + elapsed
if elapsed < 2.6 then
local alpha = elapsed % 1.3
if alpha < 0.15 then
self:SetAlpha(alpha / 0.15)
elseif alpha < 0.9 then
self:SetAlpha(1 - (alpha - 0.15) / 0.6)
else
self:SetAlpha(0)
end
else
self:Hide()
end
self.elapsed = elapsed
end)
self.FlashFrame = flasher
end
self.FlashFrame:Show()
end
self.TimeSinceLastUpdate = 0
end
end
end
end)
end
I could really use some help on this.