Closed Thread
Thread Tools Display Modes
Unread 11-09-09, 04:19 AM   #301
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
Your currently only going to look at the latency between click and event for this current spell cast. This has the potential to give very spiky results, which is why most implementations use an average value over a period of time.

How are you going to ensure that the click event matches up with the next received event?

What would happen if the user spam-clicks a button? In your current example code the latency would not be accurate due to the 'sent' variable being overwritten on every click.



Using the GetNetStats() routine gives results that are good enough for most situations, especially considering how many potential error conditions you would need to cater for in your proposed design.
yj589794 is offline  
Unread 11-09-09, 05:37 AM   #302
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 982
You'd also have to tackle the prediction that the client does as of 3.0. Implementing a custom GetNetStats() would be a lot better, but it would also require a lot more (useless) effort to do.
__________________
「貴方は1人じゃないよ」
haste is offline  
Unread 11-09-09, 06:14 AM   #303
gorocketgo
A Defias Bandit
Join Date: Nov 2009
Posts: 2
Thanks

Thanks for the replies. I guess I have more learning to do. And thanks for addon - teaches me a lot.
gorocketgo is offline  
Unread 11-09-09, 01:50 PM   #304
Gandoch
A Wyrmkin Dreamwalker
 
Gandoch's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 50
Pet Despawn Error

I used to occasionally get this error message when mounting/entering vehicles when I have a pet summoned on my warlock. Seemingly anytime my pet gets "put away" or is manually dismissed there was a chance I'd get this error. After making some changes to my tags file, I am getting it much more frequently. Any thoughts or help would be greatly appreciated.

Error:
Code:
Message: Interface\AddOns\oUF\ouf.lua:523: bad argument #1 to 'select' (index out of range)
Time: 11/09/09 14:38:26
Count: 903
Stack: [string "Interface\FrameXML\BasicControls.xml:<Scrip..."]:18: in function <[string "Interface\FrameXML\BasicControls.xml:<Scrip..."]:4>
[C]: ?
[C]: ?
Interface\AddOns\oUF\ouf.lua:523: in function `ColorGradient'
Interface\AddOns\oUF_Gandoch\tags.lua:50: in function `func'
Interface\AddOns\oUF\elements\tags.lua:402: in function `UpdateTag'
Interface\AddOns\oUF\elements\tags.lua:259: in function <Interface\AddOns\oUF\elements\tags.lua:255>

Locals: (*temporary) = -1.#IND
(*temporary) = 1
(*temporary) = 0
(*temporary) = 0
(*temporary) = 1
(*temporary) = 1
(*temporary) = 0
(*temporary) = 0
(*temporary) = 1
(*temporary) = 0
Tags.lua:
Code:
oUF.Tags['[ghealth]'] = function(unit)
	local min, max = UnitHealth(unit), UnitHealthMax(unit)
(50)	local color = hex(oUF.ColorGradient(min/max, unpack(oUF.colors.smooth)))

	local def = min ~= max and ("-%s%s|r"):format(color, shortVal(max-min))
	local full = min == max and ("%s%s|r"):format(color, shortVal(max))
	local detailed = ("%s%s|r - %s%d|r%%"):format(color, shortVal(min), color, min/max*100)
	local status = UnitIsAFK(unit) and "|cffabababAFK|r" or not UnitIsConnected(unit) and "|cffcbcbcbOffline|r" or UnitIsGhost(unit) and "|cffdededeGhost|r" or UnitIsDead(unit) and "|cffff0000Dead|r"
	
	return status and status or (unit == "target" or unit == "targettarget" or unit == "focus") and detailed or (unit ~= "player" and unit ~= "pet" and not UnitInRaid(unit)) and full or def
end
I've tried making sure min and max exist before declaring or assigning local color, but I get the same error message with roughly the same frequency.
Gandoch is offline  
Unread 11-09-09, 02:21 PM   #305
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 982
You'll have to check for the value being inf or not. I guess I should translate inf into 1 in oUF to prevent that issue.
__________________
「貴方は1人じゃないよ」
haste is offline  
Unread 11-09-09, 02:29 PM   #306
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 982
Consider it fixed in 13d3e56b.
__________________
「貴方は1人じゃないよ」
haste is offline  
Unread 11-10-09, 02:52 PM   #307
Gandoch
A Wyrmkin Dreamwalker
 
Gandoch's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 50
Originally Posted by haste View Post
Consider it fixed in 13d3e56b.
I'm still having the same problem.
Gandoch is offline  
Unread 11-10-09, 02:55 PM   #308
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 982
Originally Posted by Gandoch View Post
I'm still having the same problem.
Then dump me a debug stack from the latest git head.
__________________
「貴方は1人じゃないよ」
haste is offline  
Unread 11-13-09, 11:52 AM   #309
Gandoch
A Wyrmkin Dreamwalker
 
Gandoch's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 50
Originally Posted by haste View Post
Then dump me a debug stack from the latest git head.
Sorry, been gone a lot lately. Forgive my ignorance, but what would I need to get a full debug stack? The output I got from Bugsack looked to be identical to the default error frame (with the exception of Bugsack having some pretty colors).
Gandoch is offline  
Unread 11-14-09, 08:27 AM   #310
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 982
Originally Posted by Gandoch View Post
Sorry, been gone a lot lately. Forgive my ignorance, but what would I need to get a full debug stack? The output I got from Bugsack looked to be identical to the default error frame (with the exception of Bugsack having some pretty colors).
Same thing as earlier, but with the latest git head.
__________________
「貴方は1人じゃないよ」
haste is offline  
Unread 11-14-09, 12:12 PM   #311
Gandoch
A Wyrmkin Dreamwalker
 
Gandoch's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 50
Code:
Message: Interface\AddOns\oUF\ouf.lua:538: bad argument #1 to 'select' (index out of range)
Time: 11/14/09 13:10:57
Count: 126
Stack: [string "Interface\FrameXML\BasicControls.xml:<Scrip..."]:18: in function <[string "Interface\FrameXML\BasicControls.xml:<Scrip..."]:4>
[C]: ?
[C]: ?
Interface\AddOns\oUF\ouf.lua:538: in function `ColorGradient'
Interface\AddOns\oUF_Gandoch\tags.lua:50: in function `func'
Interface\AddOns\oUF\elements\tags.lua:414: in function `UpdateTag'
Interface\AddOns\oUF\elements\tags.lua:271: in function <Interface\AddOns\oUF\elements\tags.lua:267>

Locals: (*temporary) = -1.#IND
(*temporary) = 1
(*temporary) = 0
(*temporary) = 0
(*temporary) = 1
(*temporary) = 1
(*temporary) = 0
(*temporary) = 0
(*temporary) = 1
(*temporary) = 0
My tags file is unchanged since the last post.
Gandoch is offline  
Unread 11-14-09, 05:11 PM   #312
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 982
Solved with 533d595 .
__________________
「貴方は1人じゃないよ」
haste is offline  
Unread 11-14-09, 06:29 PM   #313
Gandoch
A Wyrmkin Dreamwalker
 
Gandoch's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 50
Originally Posted by haste View Post
Solved with 533d595 .
I appreciate all the work, but it still seems to be... not solved.
Code:
Message: Interface\AddOns\oUF\ouf.lua:541: bad argument #1 to 'select' (index out of range)
Time: 11/14/09 19:23:20
Count: 105
Stack: [string "Interface\FrameXML\BasicControls.xml:<Scrip..."]:18: in function <[string "Interface\FrameXML\BasicControls.xml:<Scrip..."]:4>
[C]: ?
[C]: ?
Interface\AddOns\oUF\ouf.lua:541: in function `ColorGradient'
Interface\AddOns\oUF_Gandoch\tags.lua:50: in function `func'
Interface\AddOns\oUF\elements\tags.lua:414: in function `UpdateTag'
Interface\AddOns\oUF\elements\tags.lua:271: in function <Interface\AddOns\oUF\elements\tags.lua:267>

Locals: (*temporary) = -1.#IND
(*temporary) = 1
(*temporary) = 0
(*temporary) = 0
(*temporary) = 1
(*temporary) = 1
(*temporary) = 0
(*temporary) = 0
(*temporary) = 1
(*temporary) = 0
I've been trying to debug it myself, but I'm not having any luck either.
Gandoch is offline  
Unread 11-14-09, 07:19 PM   #314
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,312
Mind showing your layout's tags.lua file?
p3lim is offline  
Unread 11-14-09, 07:25 PM   #315
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 982
Originally Posted by Gandoch View Post
I've been trying to debug it myself, but I'm not having any luck either.
The reason it happens it because you divide by zero, then feed that as a percentage value into oUF's ColorGradient function. What I'm trying to do however is fix that error.
__________________
「貴方は1人じゃないよ」
haste is offline  
Unread 11-14-09, 08:58 PM   #316
Gandoch
A Wyrmkin Dreamwalker
 
Gandoch's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 50
Originally Posted by p3lim View Post
Mind showing your layout's tags.lua file?
Code:
oUF.Tags['[ghealth]'] = function(unit)
	local min, max = UnitHealth(unit), UnitHealthMax(unit)
(50)	local color = hex(oUF.ColorGradient(min/max, unpack(oUF.colors.smooth)))

	local def = min ~= max and ("-%s%s|r"):format(color, shortVal(max-min))
	local full = min == max and ("%s%s|r"):format(color, shortVal(max))
	local detailed = ("%s%s|r - %s%d|r%%"):format(color, shortVal(min), color, min/max*100)
	local status = UnitIsAFK(unit) and "|cffabababAFK|r" or not UnitIsConnected(unit) and "|cffcbcbcbOffline|r" or UnitIsGhost(unit) and "|cffdededeGhost|r" or UnitIsDead(unit) and "|cffff0000Dead|r"
	
	return status and status or (unit == "target" or unit == "targettarget" or unit == "focus") and detailed or (unit ~= "player" and unit ~= "pet" and not UnitInRaid(unit)) and full or def
end
Originally Posted by haste
The reason it happens it because you divide by zero, then feed that as a percentage value into oUF's ColorGradient function. What I'm trying to do however is fix that error.
I can try to add error checking to the tag, but nothing I've tried in modifying the ColorGradient function has worked.
Gandoch is offline  
Unread 11-15-09, 12:25 AM   #317
Gandoch
A Wyrmkin Dreamwalker
 
Gandoch's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 50
Code:
oUF.Tags['[ghealth]'] = function(unit)
	local min, max = UnitHealth(unit), UnitHealthMax(unit)
(+)	if max <= 0 then max = 0.01 end
	local color = hex(oUF.ColorGradient(min/max, unpack(oUF.colors.smooth)))

	local def = min ~= max and ("-%s%s|r"):format(color, shortVal(max-min))
	local full = min == max and ("%s%s|r"):format(color, shortVal(max))
	local detailed = ("%s%s|r - %s%d|r%%"):format(color, shortVal(min), color, min/max*100)
	local status = UnitIsAFK(unit) and "|cffabababAFK|r" or not UnitIsConnected(unit) and "|cffcbcbcbOffline|r" or UnitIsGhost(unit) and "|cffdededeGhost|r" or UnitIsDead(unit) and "|cffff0000Dead|r"
	
	return status and status or (unit == "target" or unit == "targettarget" or unit == "focus") and detailed or (unit ~= "player" and unit ~= "pet" and not UnitInRaid(unit)) and full or def
end
Fixing it in the tag seems the easiest thing to do.
Gandoch is offline  
Unread 11-15-09, 12:57 PM   #318
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 982
It's fixed for real(!) this time. I completely forgot that NaN doesn't equal NaN. I did some quick tests to confirm that it actually works as well this time.

Edit: For those who wonder. It's fixed with 88b2ec7. So much trouble for almost nothing :P.
__________________
「貴方は1人じゃないよ」
haste is offline  
Unread 11-15-09, 01:05 PM   #319
Gandoch
A Wyrmkin Dreamwalker
 
Gandoch's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 50
Originally Posted by haste View Post
It's fixed for real(!) this time. I completely forgot that NaN doesn't equal NaN. I did some quick tests to confirm that it actually works as well this time.

Edit: For those who wonder. It's fixed with 88b2ec7. So much trouble for almost nothing :P.
Oh jeez; that's quite the quirk, isn't it? Thanks again, haste.
Gandoch is offline  
Unread 11-16-09, 12:43 AM   #320
Quokka
A Chromatic Dragonspawn
 
Quokka's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 196
Having a small error with my latest rework

Code:
[07:25:36] Interface\AddOns\oUF\ouf.lua:523: bad argument #1 to 'select' (index out of range)
[C]: ?
[C]: ?
Interface\AddOns\oUF\ouf.lua:523: in function `ColorGradient'
Interface\AddOns\oUF_AI\oUF_AI.lua:263: in function <Interface\AddOns\oUF_AI\oUF_AI.lua:227>
Interface\AddOns\oUF_HealComm4\oUF_HealComm4.lua:166: in function `PostUpdateHealth'
Interface\AddOns\oUF\elements\health.lua:98: in function `UNIT_MAXHEALTH'
Interface\AddOns\oUF\elements\health.lua:43: in function <Interface\AddOns\oUF\elements\health.lua:36>
what is going wrong everything seems to wotk fine

in ouf_AI
Code:
local function PostUpdateHealth(self, event, unit, bar, min, max) --LINE 227

    if(UnitIsDead(unit)) then 
        bar.value:SetText('Dead') 
    elseif(UnitIsGhost(unit)) then 
        bar.value:SetText('Ghost') 
    elseif(not UnitIsConnected(unit)) then 
        bar:SetValue(0) 
        bar.value:SetText('Offline') 
    else 
		if(min~=max) then
		local r, g, b
		r, g, b = oUF.ColorGradient(min/max, unpack(oUF.colors.smooth))
			if(unit=='player' or unit=='pet') then 
				bar.value:SetFormattedText('%d (|cff%02x%02x%02x%d|r%%)', (min), r*255, g*255, b*255, (min/max)*100)
			elseif(unit=='target' or unit=='focus') then 
				bar.value:SetFormattedText('%s (|cff%02x%02x%02x%.1f|r%%)', letter(min), r*255, g*255, b*255, (min/max)*100)
			elseif(self:GetParent():GetName():match'oUF_Raid') then
				bar.value:SetFormattedText('|cffff8080%s|r', rletter(min-max))
			else
				bar.value:SetFormattedText('|cffff8080%s|r', letter(min-max))
			end
		else
			if(unit=='player' or unit=='pet') then  
				bar.value:SetFormattedText('%s', (max))
			elseif(unit=='target' or unit=='focus') then 
				bar.value:SetFormattedText('%s', letter(max))
			else
				bar.value:SetText('')
			end
		end
	end
	
	if(UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) and not UnitIsPlayer(unit)) then 
        bar:SetStatusBarColor(0.7,0.7,0.7)
    else 
		local r, g, b = oUF.ColorGradient(min/max, unpack(oUF.colors.smooth))--LINE 263
		bar:SetStatusBarColor(r, g, b)
    end 
	
	self:UNIT_NAME_UPDATE(event, unit)
end
Quokka is offline  
Closed Thread

Go BackWoWInterface » Featured Projects » oUF (Otravi Unit Frames) » oUF - General discussion

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