-
Posted by tataboutlamine on Tue, 03 Mar 2009 10:11:49
i was making the TargetText tutorial addon and while testing each functions, i noticed that the TargetTextFrameManaLabel fontstring wasn't showing at all. i don'T know if its been mentionned already in the forums (i've checked all topics on chapter 13, some of them answering other questions, but didn't find anything about that). So i double checked the xml doc to be sure my frame existed, compared everything with your downloadable example, bypassing known erratas but i couldn't find the reason
then i checked the UnitFrame.lua and studied the part where they update manatype. (namely the UnitFrame_UpdateManaType function) when they are calling the UnitPowerType function, they are storing the returns in 2 variables : powerType and powerToken.
powerType seems to be the number from 0 to 6 associated with each type of powers and powerToken is the actual string in uppercase. when you are writing
function TargetText:UpdatePowerType()
local info = PowerBarColor[UnitPowerType("target")]TargetTextFrameManaLabel:SetText(info.prefix)
TargetTextFrameMana:SetTextColor(info.r, info.g, in fo.b)
endThe third line isn't referring to anything anymore. This is how they get the string in the UnitFrame.lua :
local powerType, powerToken = UnitPowerType(unitFrame.unit);
local prefix = getglobal(powerToken);
local info = PowerBarColor[powerToken];where what we're interested in is named "prefix" but as a local variable to the UnitFrame_UpdateManaType function. i was intrigued by that and checked your reference documentation for UnitPowerType. it says it only returns a number where clearly it returns both a number and a string. it is actually the string that is useful but since its the second return argument, it is not stored into "info". to get the right localized text, i modified TargetText UpdatePowerType function using their method :
function TargetText:UpdatePowerType()
local PowerType,PowerToken = UnitPowerType("target")
local info=PowerBarColor[PowerType]
TargetTextFrameManaLabel:SetText(getglobal(PowerToken))
TargetTextFrameMana:SetTextColor(info.r, info.g, info.b)
endit seems that PowerType can only be used in the PowerBarColor table whereas the PowerToken can be used in the table and in getting the localized string using getglobal.
i don't know if its been documented elsewhere (i didn'T have time to check other sites) but i thought it worth mentionning since even the reference is wrong.
-
Posted by tataboutlamine on Tue, 03 Mar 2009 10:11:49
i was making the TargetText tutorial addon and while testing each functions, i noticed that the TargetTextFrameManaLabel fontstring wasn't showing at all. i don'T know if its been mentionned already in the forums (i've checked all topics on chapter 13, some of them answering other questions, but didn't find anything about that). So i double checked the xml doc to be sure my frame existed, compared everything with your downloadable example, bypassing known erratas but i couldn't find the reason
then i checked the UnitFrame.lua and studied the part where they update manatype. (namely the UnitFrame_UpdateManaType function) when they are calling the UnitPowerType function, they are storing the returns in 2 variables : powerType and powerToken.
powerType seems to be the number from 0 to 6 associated with each type of powers and powerToken is the actual string in uppercase. when you are writing
function TargetText:UpdatePowerType()
local info = PowerBarColor[UnitPowerType("target")]TargetTextFrameManaLabel:SetText(info.prefix)
TargetTextFrameMana:SetTextColor(info.r, info.g, in fo.b)
endThe third line isn't referring to anything anymore. This is how they get the string in the UnitFrame.lua :
local powerType, powerToken = UnitPowerType(unitFrame.unit);
local prefix = getglobal(powerToken);
local info = PowerBarColor[powerToken];where what we're interested in is named "prefix" but as a local variable to the UnitFrame_UpdateManaType function. i was intrigued by that and checked your reference documentation for UnitPowerType. it says it only returns a number where clearly it returns both a number and a string. it is actually the string that is useful but since its the second return argument, it is not stored into "info". to get the right localized text, i modified TargetText UpdatePowerType function using their method :
function TargetText:UpdatePowerType()
local PowerType,PowerToken = UnitPowerType("target")
local info=PowerBarColor[PowerType]
TargetTextFrameManaLabel:SetText(getglobal(PowerToken))
TargetTextFrameMana:SetTextColor(info.r, info.g, info.b)
endit seems that PowerType can only be used in the PowerBarColor table whereas the PowerToken can be used in the table and in getting the localized string using getglobal.
i don't know if its been documented elsewhere (i didn'T have time to check other sites) but i thought it worth mentionning since even the reference is wrong.
-
Posted by jnwhiteh on Tue, 03 Mar 2009 11:25:12
The system indeed changed quite drastically in the 3.X patch and most of the changes were documented on the WoW forums as one would expect. The information has not made it onto the live reference yet due to time constraints. There are a NUMBER of changes to the TargetText addon, many of the details have been posted on these forums.