Thread Tools Display Modes
01-25-09, 08:54 AM   #561
jadakren
A Flamescale Wyrmkin
 
jadakren's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2007
Posts: 103
castbars on focustarget & targetarget?

Been a while since i had castbars on anything but focus and target, but I had this impression that I could have them on any frame...am I wrong?

layout is like :
Code:
[focustarget]                       [targettarget]

[focus-----------]             [-----------target]
              [       player      ]
I tried enabling them : http://pastey.net/106981/471

I end up with castbars on the focustarget & targettarget frames that dont do anything and remain visible all the time regardless of casting state.

not-casting:

casting:
 
01-25-09, 09:17 AM   #562
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
oUF doesn't do castbars on eventless units.
 
01-25-09, 11:04 AM   #563
duhwhat
A Wyrmkin Dreamwalker
Join Date: Aug 2008
Posts: 51
how would i enable power value display when the pet frame has energy (e.g Malygos drakes), but hide the value, and perhaps the power bar completely when the pet frame has mana (warlock pets)?
 
01-25-09, 11:08 AM   #564
Bruners
A Flamescale Wyrmkin
 
Bruners's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 125
Originally Posted by duhwhat View Post
how would i enable power value display when the pet frame has energy (e.g Malygos drakes), but hide the value, and perhaps the power bar completely when the pet frame has mana (warlock pets)?
you can try to do a check with this function
http://www.wowwiki.com/API_UnitPowerType
 
01-25-09, 01:29 PM   #565
deadwizard
A Murloc Raider
Join Date: Jun 2005
Posts: 5
Hi guys!

I am totally new to LUA and pretty much have no knowledge in it but i've been trying to find a way to replace the numeric values for percentage values instead for health and Mana display.

Am using oUF Obble square plugging and so far here's what i think needs to be changed:

local function numberize(value)
if(value >= 1e6) then
return string.format('%.1fm', value / 1e6)
elseif(value >= 1e4) then
return string.format('%.1fk', value / 1e3)
else
return value
end
end

local updateHealth = function(self, event, unit, bar, min, max)
if(not UnitIsConnected(unit)) then
bar.value:SetText('C')
elseif(UnitIsDead(unit)) then
bar.value:SetText('')
elseif(UnitIsGhost(unit)) then
bar.value:SetText(':G')
else
local r,g,b = oUF.ColorGradient(min/max, 181, 79, 79, 181, 110, 68, 0, 255, 0)
if(unit=='player' or unit=='target') then
bar.value:SetFormattedText('|cff%02x%02x%02x%s|r', r, g, b, numberize(min))
else
bar.value:SetFormattedText('|cff%02x%02x%02x%s|r', r, g, b, numberize(min))
end
end

local updatePower = function(self, event, unit, bar, min, max)
local color = self.colors.power[powertype]
if(min == 0) then
bar.value:SetText()
elseif(UnitIsDead(unit) or UnitIsGhost(unit)) then
bar:SetValue(0)
elseif(not UnitIsConnected(unit)) then
bar.value:SetText()
elseif unit=="player" then
bar.value:SetText(numberize(min))
if color then
bar.value:SetTextColor(color[1], color[2], color[3])
else
bar.value:SetText(numberize(min))
bar.value:SetTextColor(0.2, 0.66, 0.93)
end
else
bar.value:SetFormattedText(numberize(min))
if color then
bar.value:SetTextColor(color[1], color[2], color[3])
else
bar.value:SetTextColor(0.2, 0.66, 0.93)
end
end
end


I'd prefer seeing % value as far as health and mana goes instead of the absolute values as it is right now. Hope its not too hard to change.
 
01-25-09, 01:58 PM   #566
ObbleYeah
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 210
Originally Posted by deadwizard View Post
bar.value:SetFormattedText('|cff%02x%02x%02x%s|r', r, g, b, numberize(min))
Is what you need to change. Can't remember the % formatted text atm off the top my head atm though :<
 
01-25-09, 03:20 PM   #567
deadwizard
A Murloc Raider
Join Date: Jun 2005
Posts: 5
Originally Posted by ObbleYeah View Post
Is what you need to change. Can't remember the % formatted text atm off the top my head atm though :<

I was able to get something with (min/max)*100 but when am loosing health, instead of showing the % value...it still displays the abs values

Ex: 76% is instead shown as 76.5726579293786 when adding min/max*100


Getting somewhere i guess
 
01-25-09, 03:30 PM   #568
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by deadwizard View Post
I was able to get something with (min/max)*100 but when am loosing health, instead of showing the % value...it still displays the abs values

Ex: 76% is instead shown as 76.5726579293786 when adding min/max*100


Getting somewhere i guess
instead of %s or %d use %.0f
 
01-25-09, 03:59 PM   #569
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Originally Posted by p3lim View Post
instead of %s or %d use %.0f
Instead of what he said, use %d.
 
01-25-09, 04:01 PM   #570
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by haste View Post
Instead of what he said, use %d.
If so the deficits will still show, unless you use math.floor ofcourse.
 
01-25-09, 04:27 PM   #571
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Code:
Lua 5.1.3  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> return string.format('%s', math.pi)
3.1415926535898
> return string.format('%d', math.pi)
3
> return string.format('%i', math.pi)
3
> return string.format('%.2f', math.pi)
3.14
> return string.format('%.1f', math.pi)
3.1
> return string.format('%.0f', math.pi)
3
 
01-25-09, 04:32 PM   #572
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by haste View Post
Code:
Lua 5.1.3  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> return string.format('%s', math.pi)
3.1415926535898
> return string.format('%d', math.pi)
3
> return string.format('%i', math.pi)
3
> return string.format('%.2f', math.pi)
3.14
> return string.format('%.1f', math.pi)
3.1
> return string.format('%.0f', math.pi)
3
Now I know that
 
01-25-09, 07:22 PM   #573
deadwizard
A Murloc Raider
Join Date: Jun 2005
Posts: 5
I don't seem to get it..


This is the return string part

local function numberize(value)
if(value >= 1e6) then
return string.format('%.1fm', value / 1e6)
elseif(value >= 1e4) then
return string.format('%.1fk', value / 1e3)
else
return value
end


and the setformatted value

bar.value:SetFormattedText('|cff%02x%02x%02x%s|r', r, g, b, numberize(min))

Thanks for all the help guys
 
01-26-09, 07:35 PM   #574
deadwizard
A Murloc Raider
Join Date: Jun 2005
Posts: 5
So maybe Obble can help me out here...


What would be the new string formatted text? I've search and tried to understand what to change but to no available
 
01-27-09, 02:58 AM   #575
Blood Druid
A Fallenroot Satyr
Join Date: Oct 2008
Posts: 26
There was a problem on Malygos, are not shown combo points, here my code:

Code:
if ((PlayerClass == 'ROGUE') or (PlayerClass == 'DRUID') or (unit == 'pet')) and (unit == 'target') then
	self.CPoints = self:CreateFontString(nil, 'BACKGROUND', 'GameFontNormalHuge')
	self.CPoints:SetPoint('TOPRIGHT', self.Health, 'TOPLEFT', -4, 0)
	self.CPoints:SetTextColor(1,1,1)
	self.CPoints:SetJustifyH('RIGHT')
	if(unit == 'pet') then
		self.CPoints.unit = 'pet'
	else
		self.CPoints.unit = 'player'
	end
end
What do I do not so?
 
01-27-09, 05:04 AM   #576
Bruners
A Flamescale Wyrmkin
 
Bruners's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 125
Originally Posted by Blood Druid View Post
There was a problem on Malygos, are not shown combo points, here my code:

Code:
if ((PlayerClass == 'ROGUE') or (PlayerClass == 'DRUID') or (unit == 'pet')) and (unit == 'target') then
	self.CPoints = self:CreateFontString(nil, 'BACKGROUND', 'GameFontNormalHuge')
	self.CPoints:SetPoint('TOPRIGHT', self.Health, 'TOPLEFT', -4, 0)
	self.CPoints:SetTextColor(1,1,1)
	self.CPoints:SetJustifyH('RIGHT')
	if(unit == 'pet') then
		self.CPoints.unit = 'pet'
	else
		self.CPoints.unit = 'player'
	end
end
What do I do not so?
You could try this

Code:
if (unit == 'target') then
	self.CPoints = self:CreateFontString(nil, 'BACKGROUND', 'GameFontNormalHuge')
	self.CPoints:SetPoint('TOPRIGHT', self.Health, 'TOPLEFT', -4, 0)
	self.CPoints:SetTextColor(1,1,1)
	self.CPoints:SetJustifyH('RIGHT')
	if(unit == 'pet') then
		self.CPoints.unit = 'pet'
	else
		self.CPoints.unit = 'player'
	end
end
To test this you can do this quest http://www.wowhead.com/?quest=13414
you can still mount the dragon after you have completed the quest

if that's not working you can try to remove

Code:
	if(unit == 'pet') then
		self.CPoints.unit = 'pet'
	else
		self.CPoints.unit = 'player'
	end
 
01-27-09, 05:28 AM   #577
Bruners
A Flamescale Wyrmkin
 
Bruners's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 125
Originally Posted by deadwizard View Post
I don't seem to get it..


This is the return string part


and the setformatted value

Thanks for all the help guys
For starters, don't use the
..
functions when you are pasting code, but use the
Code:
 ...
I'm not completely sure about what you are trying to achieve, but i'm guessing that you want to display only the % value of your health and not what you actually have.

Code:
bar.value:SetFormattedText('|cff%02x%02x%02x%d%%|r', r, g, b, (min/max*100))
If you want health and % health you can do

Code:
bar.value:SetFormattedText('|cff%02x%02x%02x%s %d%%|r', r, g, b, numberise(min), (min/max*100))

also read up on http://lua-users.org/wiki/StringLibraryTutorial

Last edited by Bruners : 01-27-09 at 05:35 AM.
 
01-27-09, 06:33 AM   #578
deadwizard
A Murloc Raider
Join Date: Jun 2005
Posts: 5
Originally Posted by Bruners View Post
For starters, don't use the functions when you are pasting code, but use the
Code:
 ...
I'm not completely sure about what you are trying to achieve, but i'm guessing that you want to display only the % value of your health and not what you actually have.

Code:
bar.value:SetFormattedText('|cff%02x%02x%02x%d%%|r', r, g, b, (min/max*100))
If you want health and % health you can do

Code:
bar.value:SetFormattedText('|cff%02x%02x%02x%s %d%%|r', r, g, b, numberise(min), (min/max*100))

also read up on http://lua-users.org/wiki/StringLibraryTutorial



Thank you very much.
 
01-28-09, 12:13 AM   #579
Blood Druid
A Fallenroot Satyr
Join Date: Oct 2008
Posts: 26
Originally Posted by Bruners View Post
You could try this

Code:
if (unit == 'target') then
	self.CPoints = self:CreateFontString(nil, 'BACKGROUND', 'GameFontNormalHuge')
	self.CPoints:SetPoint('TOPRIGHT', self.Health, 'TOPLEFT', -4, 0)
	self.CPoints:SetTextColor(1,1,1)
	self.CPoints:SetJustifyH('RIGHT')
	if(unit == 'pet') then
		self.CPoints.unit = 'pet'
	else
		self.CPoints.unit = 'player'
	end
end
To test this you can do this quest http://www.wowhead.com/?quest=13414
you can still mount the dragon after you have completed the quest

if that's not working you can try to remove

Code:
	if(unit == 'pet') then
		self.CPoints.unit = 'pet'
	else
		self.CPoints.unit = 'player'
	end

Principal cause was self.CPoints.unit = 'player'
removal has helped, as has removed class limitations.

And still a question:
I have forgotten, for what was set self.CPoints.unit = 'player' ?
 
01-28-09, 09:55 AM   #580
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by Blood Druid View Post
Principal cause was self.CPoints.unit = 'player'
removal has helped, as has removed class limitations.

And still a question:
I have forgotten, for what was set self.CPoints.unit = 'player' ?
cpoints.unit is always the same as the frame unit unless overrid.
myself i use cpoints.unit = 'target' on player frame.
 

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » oUF - Layout discussion


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