View Single Post
06-15-14, 12:26 PM   #23
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Getting and Error

I get a error with the following code when ever someone refuses or I do not accept the LFG Invite. Is there a way to say "if nil then" ?

Thanks
Coke

Code:
	-- Code provided by Phanx from WoWInterface.com

	local PROPOSAL_DURATION = 60

	local f = CreateFrame("Frame", nil, LFGDungeonReadyPopup)

	-- This variable needs to be outside of the OnUpdate so it persists between executions:
	local remaining = PROPOSAL_DURATION

	
	f:SetScript("OnUpdate", function(self, elapsed) -- You need to know how much time has elapsed
		-- Deduct the elapsed time (since the last OnUpdate) from the total remaining time:
		remaining = remaining - elapsed

		local color = remaining > 20 and "20ff20" or remaining > 10 and "ffff00" or "ff0000"

		-- Use SetFormattedText here, and don't split the color code in the middle of the alpha value.
		local _, _, typeID, subtypeID, _, _, _, _, _, _, numMembers, _ = GetLFGProposal();
		if ( typeID == TYPEID_RANDOM_DUNGEON and subtypeID ~= LFG_SUBTYPEID_SCENARIO ) then
			LFGDungeonReadyDialog.label:SetFormattedText(RANDOM_DUNGEON_IS_READY.." |cff%s%s|r remaining.", color, SecondsToTime(remaining))
		else
            if ( numMembers > 1 ) then
                LFGDungeonReadyDialog.label:SetFormattedText(SPECIFIC_DUNGEON_IS_READY.." |cff%s%s|r remaining.", color, SecondsToTime(remaining));
            else
                LFGDungeonReadyDialog.label:SetFormattedText(SPECIFIC_INSTANCE_IS_READY.." |cff%s%s|r remaining.", color, SecondsToTime(remaining));
            end
		end
	end)

	f:RegisterEvent("LFG_PROPOSAL_SHOW")
	f:SetScript("OnEvent", function(self, event)
		if event == "LFG_PROPOSAL_SHOW" then
			-- Restart the timer:
			remaining = PROPOSAL_DURATION
			self:Show()
		else
			self:Hide()
		end
	end)
Error shown by Buggsack:
Code:
62x nExtras\nExtras-5.4.5.lua:445: attempt to compare number with nil
nExtras\nExtras-5.4.5.lua:445: in function <nExtras\nExtras.lua:434>

Locals:

Last edited by cokedrivers : 06-15-14 at 01:22 PM.
  Reply With Quote