Quantcast a problem that causes disconnect but no errors - Page 2 - WoWInterface
Thread Tools Display Modes
01-31-12, 02:10 AM   #21
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Originally Posted by Seerah View Post
Turn everything off completely and see if you're starting to DC with the default UI now.
Tried that it stops with everthing off, stops even with just GrimUI off, heck stops even with half the UI error'ed out lol. im going through and running it one file at a time... ill find the culprit eventually it just may take a few days lol.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
01-31-12, 10:14 AM   #22
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,739
Animation models had I bug. But they fixed that on the PTR afaik. (My model viewer caused memory overflow by viewing 10.000x models in a short amount of time ).

Roth UI uses animation models all over. There are no disconnect issues.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW) | TDMOG

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
01-31-12, 10:37 AM   #23
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
You know what would be super annoying is to find out in the end its some bug on bliz's end and not a change i made
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
01-31-12, 09:13 PM   #24
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
I FOUND IT!!!!!!!!!!!!!!!!!!!!!!! Well i figured out where the problem code is anyhow... what the exact problem is is still currently beyond me but the cause of the dcing is in this code here -

Code:
local addonName, addon = ...

--[[-----------------------------------------------------------------------------
Configure Rep and Exp bars
-------------------------------------------------------------------------------]]
function addon:ConfigureExpBar()
	if addon.settings.showExpBar == true then
		addon:ShowFrame("GrimExpBar")
		_G["GrimRepBar"]:ClearAllPoints()
		_G["GrimRepBar"]:SetPoint('TOPRIGHT', "GrimExpBar", "BOTTOMRIGHT", 0, 0)
	else
		addon:HideFrame("GrimExpBar")
		if GUI_PlayerMana ~= nil then
			_G["GrimRepBar"]:ClearAllPoints()
			_G["GrimRepBar"]:SetPoint('TOPRIGHT', "GUI_PlayerMana", "BOTTOMRIGHT", 0, 0)
		else
			_G["GrimRepBar"]:ClearAllPoints()
			_G["GrimRepBar"]:SetPoint('LEFT', UIParent, "LEFT", 0, 0)
		end
	end
end

function addon:ConfigureRepBar()
	if addon.settings.showRepBar == true then
		addon:ShowFrame("GrimRepBar")
    else
		addon:HideFrame("GrimRepBar")
    end
	
end

---------------------------
-- Xp Bar
-----------------------
local GrimExpBar = CreateFrame('button', "GrimExpBar", UIParent)

GrimExpBar:RegisterEvent("PLAYER_XP_UPDATE")
GrimExpBar:RegisterEvent("PLAYER_LEVEL_UP", "level")
GrimExpBar:RegisterEvent("UPDATE_EXHAUSTION")
GrimExpBar:RegisterEvent("UNIT_PET", "player")
GrimExpBar:RegisterEvent("UNIT_PET_EXPERIENCE", "player")
GrimExpBar:RegisterEvent("PLAYER_GUILD_UPDATE")
GrimExpBar:RegisterEvent("GUILD_XP_UPDATE")

GrimExpBar:SetHeight(20)
GrimExpBar:SetWidth(235)
GrimExpBar:SetFrameStrata("HIGH")
GrimExpBar:SetFrameLevel("4")

local xpBar = CreateFrame("StatusBar", nil, GrimExpBar, "TextStatusBar")
xpBar:SetAllPoints("GrimExpBar")
xpBar:SetStatusBarTexture([[Interface\AddOns\]] .. addonName .. [[\Media\BarTexture]])
xpBar:SetStatusBarColor(0.5, 0.1, 0.9, 1)
xpBar:SetFrameLevel("3")

local xpText = xpBar:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
xpText:SetPoint("LEFT", GrimExpBar, "LEFT", 3, -2)
xpText:SetTextColor(1, 1, 1, 1)
xpText:SetFont([[Interface\AddOns\]] .. addonName .. [[\Media\Font-1.ttf]], 11.5, "OUTLINE")

local restXPbar = CreateFrame("StatusBar", nil, GrimExpBar, "TextStatusBar")
restXPbar:SetAllPoints("GrimExpBar")
restXPbar:SetStatusBarTexture([[Interface\AddOns\]] .. addonName .. [[\Media\BarTexture]])
restXPbar:SetStatusBarColor(.290, .305, .878, 1)
restXPbar:SetFrameLevel("2")

local bg = xpBar:CreateTexture(nil, "BACKGROUND")
bg:SetTexture(0, 0, 0, 0)
bg:SetAllPoints("GrimExpBar")

local function GXPBarEvent()
	local currXP, nextXP = UnitXP("Player"), UnitXPMax("Player") 
	local leftXP = (nextXP - currXP)
	local _, myClass = UnitClass("Player")
	local petXPcur, petXPnex = GetPetExperience()
	local petXPleft = (petXPnex - petXPcur)
	local restXP, percentXP = GetXPExhaustion(), floor(currXP / nextXP * 100) 
	
	local str 
	QueryGuildXP()
	local currentXP, nextLevelXP, dailyXP, maxDailyXP, unitWeeklyXP, unitTotalXP = UnitGetGuildXP("player")
	local GXPTot = (nextLevelXP + currentXP)
	local GleftXP = (nextLevelXP - currentXP)
	
	if addon.settings.showGuild == true then
		if addon.settings.xpBarvar == "xpLeft" then
			str = ("%s left - Guild"):format(nextLevelXP)
		elseif addon.settings.xpBarvar == "xpTot" then
			str = ("%s/%s Guild"):format(currentXP, GXPTot)
		end
		xpText:SetText(str) 
		xpBar:SetMinMaxValues(min(0, currentXP), GXPTot) 
		xpBar:SetValue(currentXP)
		if maxDailyXP ~= nil then
		restXPbar:SetMinMaxValues(min(0, currentXP), maxDailyXP) -- dont forget restXP must be a value or nil must be delt with
		restXPbar:SetValue(maxDailyXP) -- dont forget restXP must be a value or nil must be delt with
		end
	else
		if restXP == nil then -- nill is being delt with
			if addon.settings.xpBarvar == "xpLeft" and myClass == "HUNTER" then 
			str = ("%s left  %s Pet"):format(leftXP,  petXPleft) 
			elseif addon.settings.xpBarvar == "xpLeft" and myClass ~= "HUNTER" then
			str = ("%s left "):format(leftXP)
			elseif addon.settings.xpBarvar == "xpTot" and myClass == "HUNTER" then
			str = ("%s/%s  P %s/%s"):format(currXP, nextXP, petXPcur, petXPnex)
			elseif addon.settings.xpBarvar == "xpTot" and myClass ~= "HUNTER" then
			str = ("%s/%s "):format(currXP, nextXP)
			end
			restXPbar:SetMinMaxValues(min(0, currXP), nextXP) -- dont forget restXP must be a value or nil must be delt with
			restXPbar:SetValue(currXP) -- dont forget restXP must be a value or nil must be delt with
		else 
			local percentRestXP = floor(restXP / nextXP * 100)
			if addon.settings.xpBarvar == "xpLeft" and myClass == "HUNTER" then 
			str = ("%s left (%s %s%%R) P %s"):format(leftXP, restXP, percentRestXP, petXPleft) 
			elseif addon.settings.xpBarvar == "xpLeft" and myClass ~= "HUNTER" then
			str = ("%s left (%s %s%%R)"):format(leftXP, restXP, percentRestXP)
			elseif addon.settings.xpBarvar == "xpTot" and myClass == "HUNTER" then
			str = ("%s/%s (%s%%R) P %s/%s"):format(currXP, nextXP, percentRestXP, petXPcur, petXPnex)
			elseif addon.settings.xpBarvar == "xpTot" and myClass ~= "HUNTER" then
			str = ("%s/%s (%s%%R)"):format(currXP, nextXP, percentRestXP)
			end
			restXPbar:SetMinMaxValues(min(0, restXP), nextXP) -- dont forget restXP must be a value or nil must be delt with
			restXPbar:SetValue(currXP + restXP) -- dont forget restXP must be a value or nil must be delt with
		
		end
		xpText:SetText(str) 
		xpBar:SetMinMaxValues(min(0, currXP), nextXP) 
		xpBar:SetValue(currXP) 
	end
end


GrimExpBar:SetScript("OnEvent", function(self) 
	GXPBarEvent()
end)

GrimExpBar:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
GrimExpBar:SetScript('OnClick', function(self, button)
	if button == "LeftButton" then
		if addon.settings.xpBarvar == "xpLeft" then
			addon.settings.xpBarvar = "xpTot"
		elseif addon.settings.xpBarvar == "xpTot" then
			addon.settings.xpBarvar = "xpLeft"
		end
		
		
		
		GrimExpBar:GetScript("OnEvent")(GrimExpBar)
	else
		if addon.settings.showGuild == false then
			addon.settings.showGuild = true
		elseif addon.settings.showGuild == true then
			addon.settings.showGuild = false
		end
		GrimExpBar:GetScript("OnEvent")(GrimExpBar)
	end	
end)

------------------------------
-- Rep Bar
------------------------------

local GrimRepBar = CreateFrame('button', "GrimRepBar", UIParent)

GrimRepBar:RegisterEvent("UPDATE_FACTION")

GrimRepBar:SetHeight(20)
GrimRepBar:SetWidth(235)
GrimRepBar:SetFrameStrata("HIGH")
GrimRepBar:SetFrameLevel("4")

local repBar = CreateFrame("StatusBar", nil, GrimRepBar, "TextStatusBar")
repBar:SetAllPoints("GrimRepBar")
repBar:SetStatusBarTexture([[Interface\AddOns\]] .. addonName .. [[\Media\BarTexture]])

repBar:SetFrameLevel("3")

local repText = repBar:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
repText:SetPoint("LEFT", GrimRepBar, "LEFT", 3, -2)
repText:SetTextColor(1, 1, 1, 1)
repText:SetFont([[Interface\AddOns\]] .. addonName .. [[\Media\Font-1.ttf]], 11.5, "OUTLINE")

local function GREPBarEvent()
	local factionRep, curStanding, minRep, maxRep, curRep = GetWatchedFactionInfo()
	local leftRep = (maxRep - curRep)
	
	if factionRep == nil then
		repText:SetText("No Watched Faction")
	elseif factionRep ~= nil then
		if addon.settings.repBarvar == "repTot" then
			repstr = ("%s/%s %s"):format(curRep, maxRep, factionRep)
		elseif addon.settings.repBarvar == "repLeft" then
			repstr = ("%s left - %s"):format(leftRep, factionRep)
		end
		repText:SetText(repstr)
	end
	repBar:SetMinMaxValues(min(0, curRep), maxRep) 
	repBar:SetValue(curRep) 
	repBar:SetStatusBarColor(0.5, 0.1, 0.9, 1)
end

GrimRepBar:SetScript("OnEvent", function(self)
	GREPBarEvent()
end)

GrimRepBar:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
GrimRepBar:SetScript('OnClick', function(self, button)
	if button == "LeftButton" then
		if addon.settings.repBarvar == "repLeft" then
			addon.settings.repBarvar = "repTot"
		elseif addon.settings.repBarvar == "repTot" then
			addon.settings.repBarvar = "repLeft"
		end
		GrimRepBar:GetScript("OnEvent")(GrimRepBar)
	end	
end)


function addon:ResetExpRepBar()
	if GUI_PlayerMana ~= nil then
		_G["GrimExpBar"]:ClearAllPoints()
		_G["GrimExpBar"]:SetPoint('TOPRIGHT', 'GUI_PlayerMana', "BOTTOMRIGHT", 0, 0)
	else
		_G["GrimExpBar"]:ClearAllPoints()
		_G["GrimExpBar"]:SetPoint('LEFT', UIParent, "LEFT", 0, 0)
	end
	if addon.settings.showExpBar then
		_G["GrimRepBar"]:ClearAllPoints()
		_G["GrimRepBar"]:SetPoint('TOPRIGHT', "GrimExpBar", "BOTTOMRIGHT", 0, 0)
	else
		if GUI_PlayerMana ~= nil then
			_G["GrimRepBar"]:ClearAllPoints()
			_G["GrimRepBar"]:SetPoint('TOPRIGHT', "GUI_PlayerMana", "BOTTOMRIGHT", 0, 0)
		else
			_G["GrimRepBar"]:ClearAllPoints()
			_G["GrimRepBar"]:SetPoint('LEFT', UIParent, "LEFT", 0, 0)
		end
	end
end

--[[-----------------------------------------------------------------------------
Initialize
-------------------------------------------------------------------------------]]
addon.RegisterEvent("InitializeExpRepBar", 'PLAYER_ENTERING_WORLD', function(self, event)
	addon.UnregisterEvent(self, event)
	
	addon:ResetExpRepBar()
	addon:ConfigureExpBar()
	addon:ConfigureRepBar()
	GXPBarEvent()
	GREPBarEvent()
	ToggleGuildFrame()
	ToggleGuildFrame()
end)
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
01-31-12, 11:50 PM   #25
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
That above code worked until i added the stuff for showing guild xp so hmm maybe the issue is there? Maybe on bliz's end? As i dont see anything wrong with this code other then thats a big function calling pretty frequently... but still its not like i hooked it to an onupdate im going to break it down into functions for player xp and functions for guild xp and see if that makes any difference. Anyone see anything majorly wrong that would cause dcing?
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
02-01-12, 01:17 AM   #26
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
And the culprit is!! DUN DUN DUN !!!!! QueryGuildXP() !!!!!
not good to use in a function that runs repeatedly.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
02-01-12, 02:05 AM   #27
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Ah - yes. Any function that queries the server is a likely candidate for disconnection when spammed. I'd call it on a timer, and get the results via GUILD_XP_UPDATE.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
02-01-12, 02:45 AM   #28
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Originally Posted by Torhal View Post
Ah - yes. Any function that queries the server is a likely candidate for disconnection when spammed. I'd call it on a timer, and get the results via GUILD_XP_UPDATE.
Im not sure i understand what you mean by get the results from the event? I removed that queryfunc and the guild xp seems to be updating but its not exactly when you would think it should... which is why i had put that in there to begin with, it updates when ever i open the guild frame and then at other seemingly random times. So what your saying is setup a function on a timer like an onupdate? or? I think to better understand this, why is it that when i do getguildxp it requires the query be made to bring back the right xp amount? Why does that not get the correct amount when ever the guild_xp_update fires to begin with?
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
02-01-12, 05:43 PM   #29
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
He means that when you call QueryGuildXP(), the results are not available immediately. Once your client has finished receiving the data from the server, and the data is ready to access, the GUILD_XP_UPDATE event fires. It's just like calling QueryQuestsCompleted() and then having to wait for QUEST_QUERY_COMPLETE to fire before you can call GetQuestsCompleted() to actually get the data.

Originally Posted by Grimsin View Post
a side note to phanx - so when i put this code into tables like you had suggested in the other post it causes some issues with the secure setattrib functions for the backpack button which is why i did not go the table route.
That does not make sense.

Code:
frame:SetAttribute("name1", "value1")
frame:SetAttribute("name2", "value2")
frame:SetAttribute("foo", "bar")
and

Code:
local attributes = {
    ["name1"] = "value1",
    ["name2"] = "value2",
    ["foo"] = "bar",
}
for k, v in pairs(attributes) do
    frame:SetAttribute(k, v)
end
are absolutely identical as far as the "security" of the code is concerned. If there was any problem, it's because some other code you added/changed/removed was doing something wrong. Without seeing your actual code, though, I can't tell you what you did wrong.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » a problem that causes disconnect but no errors

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