Thread Tools Display Modes
08-13-10, 07:15 AM   #1
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 384
LFDRole indicator problems.

Hi, I'm trying to use this piece of code on my partyframes.
Similar code works fine for pvp, resting, leader, masterlooter. However with LFD role which has 3 different textures based on role there's some problems.

How can I get around this and make this work?
The error is some failure of creating/using SetTexCoord (Because the original textures use that)

Code:
	local lfdrole = CreateFrame("StatusBar", nil, self)
	lfdrole:SetStatusBarTexture(sett1ngs.texture)
	lfdrole:SetFrameStrata("MEDIUM")
	lfdrole:SetFrameLevel(4)
	lfdrole:SetHeight(sett1ngs.cicon)
	lfdrole:SetWidth(sett1ngs.cicon)
	lfdrole:SetPoint("TOPRIGHT", 1, 1)
	lfdrole:SetStatusBarColor(1, 1, 1)
	lfdrole.bd = SetBD(lfdrole, backdrop, {0,0,0,1}, "MEDIUM")

	self.LFDRole = lfdrole
	
	local isTank, isHealer, isDamage = UnitGroupRolesAssigned(unit) 
	local _, uclass = UnitClass(unit) 
	if isTank then 
		lfdrole:SetStatusBarColor(0, .7, 1)
	elseif isHealer then 
		lfdrole:SetStatusBarColor(0, 1, 0) 
	elseif isDamage then 
		lfdrole:SetStatusBarColor(1, 0, 0)
	end
__________________

  Reply With Quote
08-13-10, 07:29 AM   #2
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
The LFD element is expecting a Texture to be assigned to self.LFDRole, not a StatusBar.
  Reply With Quote
08-13-10, 07:41 AM   #3
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 384
Yes, but is there anyway to make my idea work?
__________________

  Reply With Quote
08-13-10, 07:58 AM   #4
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
maybe this (totally untested)

Code:
	local lfdrole = CreateFrame("StatusBar", nil, self)
	lfdrole:SetStatusBarTexture(sett1ngs.texture)
	lfdrole:SetFrameStrata("MEDIUM")
	lfdrole:SetFrameLevel(4)
	lfdrole:SetHeight(sett1ngs.cicon)
	lfdrole:SetWidth(sett1ngs.cicon)
	lfdrole:SetPoint("TOPRIGHT", 1, 1)
	lfdrole:SetStatusBarColor(1, 1, 1)
	lfdrole.bd = SetBD(lfdrole, backdrop, {0,0,0,1}, "MEDIUM")

	lfdrole.Update = function(self, event)
		local role = self.LFDRole
		local isTank, isHealer, isDamage = UnitGroupRolesAssigned(unit) 

		if isTank then 
			role:SetStatusBarColor(0, .7, 1)
			role:Show()
		elseif isHealer then 
			role:SetStatusBarColor(0, 1, 0) 
			role:Show()
		elseif isDamage then 
			role:SetStatusBarColor(1, 0, 0)
			role:Show()
		else
			role:Hide()
		end
	end

	self.LFDRole = lfdrole
  Reply With Quote
08-13-10, 08:46 AM   #5
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 384
It did not error, but no square (statusbar) appeared and every frame got a healer lfd icon. Even outside of the instance and not grouped.
__________________


Last edited by sacrife : 08-13-10 at 08:50 AM.
  Reply With Quote
08-13-10, 08:57 AM   #6
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
Originally Posted by sacrife View Post
It did not error, but no square (statusbar) appeared and every frame got a healer lfd icon. Even outside of the instance and not grouped.
sigh, copy&paste error.....


change this line:
Code:
		local isTank, isHealer, isDamage = UnitGroupRolesAssigned(self.unit)
  Reply With Quote
08-13-10, 09:11 AM   #7
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 384
Same result

*edit*
Wait, I think I screwed up. Let me check something. It's really a hassle to test this as I have to queue constantly for dungeons and complete them because I don't intend to be a jackass :P
__________________


Last edited by sacrife : 08-13-10 at 09:38 AM.
  Reply With Quote
08-13-10, 09:23 AM   #8
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
I'm just not sure why you are trying to use a statusbar for this anyway.

I can't really give any more suggestions until I get home and I am able to try this in-game.
  Reply With Quote
08-13-10, 09:35 AM   #9
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Using a statusbar make no sense at all when you only change the color and nothing else.

Regardless! You could just redirect .SetTexCoord to .SetStatusBarColor, and ofc change the arguments into something you'd want.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
08-13-10, 09:36 AM   #10
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 384
I use statusbars as that is because the original layout I got the concept from used it and I copied it to use it more extensively.

I'm open for idea's on how to change it if that is necessary.
__________________

  Reply With Quote
08-13-10, 09:36 AM   #11
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 384
Originally Posted by haste View Post
Using a statusbar make no sense at all when you only change the color and nothing else.

Regardless! You could just redirect .SetTexCoord to .SetStatusBarColor, and ofc change the arguments into something you'd want.
I don't know how to do that :P
I'll try.
__________________

  Reply With Quote
08-13-10, 10:08 AM   #12
Rostok
A Flamescale Wyrmkin
Join Date: Jul 2008
Posts: 127
Code:
local lfdrole = self.Health:CreateTexture(nil, 'OVERLAY')
lfdrole:SetPoint(POINT)
lfdrole:SetTexture(...)
lfdrole:SetSize(WIDTH,HEIGHT)
lfdrole.Update = updateLFD
self.LFDRole = lfdrole
	
local updateLFD = function(LFDRole, unit)
	local isTank, isHealer, isDamage = UnitGroupRolesAssigned(unit) 
	if isTank then 
		LFDRole:SetVertexColor(0, .7, 1)
	elseif isHealer then 
		LFDRole:SetVertexColor(0, 1, 0) 
	elseif isDamage then 
		LFDRole:SetVertexColor(1, 0, 0)
	end
end
we did this but the texture remains white, i read the code of the elements and the update function with .Update should work. What's wrong with this ?
  Reply With Quote
08-13-10, 10:10 AM   #13
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 384
Originally Posted by yj589794 View Post
maybe this (totally untested)

Code:
	local lfdrole = CreateFrame("StatusBar", nil, self)
	lfdrole:SetStatusBarTexture(sett1ngs.texture)
	lfdrole:SetFrameStrata("MEDIUM")
	lfdrole:SetFrameLevel(4)
	lfdrole:SetHeight(sett1ngs.cicon)
	lfdrole:SetWidth(sett1ngs.cicon)
	lfdrole:SetPoint("TOPRIGHT", 1, 1)
	lfdrole:SetStatusBarColor(1, 1, 1)
	lfdrole.bd = SetBD(lfdrole, backdrop, {0,0,0,1}, "MEDIUM")

	lfdrole.Update = function(self, event)
		local role = self.LFDRole
		local isTank, isHealer, isDamage = UnitGroupRolesAssigned(unit) 

		if isTank then 
			role:SetStatusBarColor(0, .7, 1)
			role:Show()
		elseif isHealer then 
			role:SetStatusBarColor(0, 1, 0) 
			role:Show()
		elseif isDamage then 
			role:SetStatusBarColor(1, 0, 0)
			role:Show()
		else
			role:Hide()
		end
	end

	self.LFDRole = lfdrole
This works now when I fixed something I didnt notice before.

However, is it really a problem using statusbars?
__________________

  Reply With Quote
08-13-10, 10:37 AM   #14
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
Originally Posted by Rostok View Post
Code:
local lfdrole = self.Health:CreateTexture(nil, 'OVERLAY')
lfdrole:SetPoint(POINT)
lfdrole:SetTexture(...)
lfdrole:SetSize(WIDTH,HEIGHT)
lfdrole.Update = updateLFD
self.LFDRole = lfdrole
	
local updateLFD = function(LFDRole, unit)
	local isTank, isHealer, isDamage = UnitGroupRolesAssigned(unit) 
	if isTank then 
		LFDRole:SetVertexColor(0, .7, 1)
	elseif isHealer then 
		LFDRole:SetVertexColor(0, 1, 0) 
	elseif isDamage then 
		LFDRole:SetVertexColor(1, 0, 0)
	end
end
we did this but the texture remains white, i read the code of the elements and the update function with .Update should work. What's wrong with this ?
You need to declare updateLFD before it is used:
Code:
local updateLFD = function(self, event)
   -- some functionality
end

lfdrole.Update = updateLFD

Last edited by yj589794 : 08-13-10 at 10:42 AM.
  Reply With Quote
08-13-10, 10:41 AM   #15
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
Originally Posted by sacrife View Post
This works now when I fixed something I didnt notice before.

However, is it really a problem using statusbars?
You are using a component that provides features that you are not using.

It's like using a jackhammer where a spoon would do.
  Reply With Quote
08-13-10, 11:09 AM   #16
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 384
Originally Posted by yj589794 View Post
You are using a component that provides features that you are not using.

It's like using a jackhammer where a spoon would do.
Is there a performance difference?
__________________

  Reply With Quote
08-13-10, 11:28 AM   #17
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
Nothing that you would ever notice
  Reply With Quote
08-13-10, 11:49 AM   #18
Rostok
A Flamescale Wyrmkin
Join Date: Jul 2008
Posts: 127
Originally Posted by yj589794 View Post
You need to declare updateLFD before it is used:
Code:
local updateLFD = function(self, event)
   -- some functionality
end

lfdrole.Update = updateLFD
hum yes, indeed, but i did not test it, sacrife did (i myself would have done it in the right way i think) maybe we did not comprehend each other with sacrife
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » LFDRole indicator problems.


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