 |
07/21/09, 1:58 PM
|
#136
|
|
Von Kaiser
Blood Elf Paladin
Korgath
|
Thanks ctrlfrk, I got it just how I want it with this:
font_string:SetWidth(10)
font_string:SetHeight(40)
return '%s %s%s %s',Name(unit),Angle(AFK(unit) or DND(unit))

|
|
|
|
|
07/21/09, 2:56 PM
|
#137
|
|
Piston Honda
|
spanko: I could be wrong, but I doubt you actually want that space between "AFK(0:03)" and ">". you have an extra space within your return code. This alleviates that.
font_string:SetWidth(10)
font_string:SetHeight(40)
return '%s %s%s%s',Name(unit),Angle(AFK(unit) or DND(unit))
Last edited by Hotan : 07/21/09 at 3:02 PM.
|
correlation =/= causation
|
|
|
07/21/09, 5:12 PM
|
#138
|
|
Von Kaiser
Blood Elf Paladin
Korgath
|
Good catch, thanks!
|
|
|
|
|
07/24/09, 6:33 PM
|
#139
|
|
Glass Joe
Draenei Shaman
Cenarion Circle
|
Is there anyway to use the color gradient used for a unit's health and use it for rage/mana/energy/runic power?
|
|
|
|
|
07/24/09, 9:01 PM
|
#140
|
|
Glass Joe
|
Here is a small Luatext to show how far away the unit is from you:
if not libRangeCheck then
LoadAddOn("LibRangeCheck-2.0")
libRangeCheck = LibStub("LibRangeCheck-2.0")
end
if libRangeCheck then
local minRange, maxRange = libRangeCheck:getRange(unit)
UpdateIn(1.0)
return "|cff404040%s", tostring(maxRange or "oor")
end
(Edit note: Copied across Shefki's improvement from The WowAce Thread
Some people were having trouble with the order libraries were loaded.)
You may need to install LibRangeCheck for it to work.
Last edited by ctrlfrk : 11/18/09 at 5:08 PM.
Reason: Updated to Shefki's code
|
|
|
|
|
07/25/09, 4:01 PM
|
#141
|
|
Glass Joe
Undead Mage
Sisters of Elune
|
How would I modify the following to color my mana numbers in red if more than 3500 mana has been used?
local max = Power(unit)
if max > 0 then
local cr,cg,cb = ClassColor(unit)
return "|cff%02x%02x%02x%s|r",cr,cg,cb,Power(unit)
end
I figured I'd just insert something like
If MaxPower(unit) - Power(unit) > 3500 then
return "|cffff0000%s|r%s",Power(unit)
But that doesn't seem to work.
Ok, figured it out:
local max = Power(unit)
local cr,cg,cb = ClassColor(unit)
if MaxPower(unit) - Power(unit) > 3500 then
return "|cffff0000%s|r", Power(unit)
elseif max > 0 then
return "|cff%02x%02x%02x%s|r",cr,cg,cb,Power(unit)
end
Last edited by crags : 07/25/09 at 7:58 PM.
|
|
|
|
|
07/26/09, 9:33 AM
|
#142
|
|
Glass Joe
|
After reading my way through the thread and even having a dabble at doing it my self (which simply left Pitbull looking at me as if to say " um, no.") I need to swallow my pride and admit I really need help. You may scoff but I'm completely stumped by:
[Status or [if IsMaxHP then
HP:Hide(MaxHP)
else
HP:VeryShort " . " PercentHP:Percent
end]]
and
[Status or [if IsMaxHP then
HP:Hide(MaxHP)
else
HP:Short
end]]
I know if someone can translate that in to LUA for me I'd have a rough idea, via comparison, on what I'm not picking up on. 
|
|
|
|
|
07/27/09, 12:42 AM
|
#143
|
|
Von Kaiser
|
Are there arrays in LUA? If so, are they viable (in a CPU / RAM usage sense)?
|
|
|
|
|
07/27/09, 8:47 AM
|
#144
|
|
Von Kaiser
|
Originally Posted by ravenndude
Are there arrays in LUA? If so, are they viable (in a CPU / RAM usage sense)?
|
Yes, Lua has tables. Creating your own tables isn't really viable in a medium like LuaTexts. All code in your tag executes each time the event it's tied to is triggered. That means if you're declaring your table in the tag, a new one will be created every time the tag is executed, which is very bad.
If you're talking about accessing a table that's defined elsewhere (either in the Blizzard FrameXML or in an addon of your own) then that is viable.
|
|
|
|
|
07/27/09, 2:17 PM
|
#145
|
|
Piston Honda
|
Originally Posted by crags
Ok, figured it out:
local max = Power(unit)
local cr,cg,cb = ClassColor(unit)
if MaxPower(unit) - Power(unit) > 3500 then
return "|cffff0000%s|r", Power(unit)
elseif max > 0 then
return "|cff%02x%02x%02x%s|r",cr,cg,cb,Power(unit)
end
|
While that works it is terribly inefficient. Use this code instead:
local cur,max= Power(unit),MaxPower(unit)
if max-cur > 3500 then
return "|cffff0000%s|r", cur
elseif max > 0 then
local cr,cg,cb = ClassColor(unit)
return "|cff%02x%02x%02x%s|r",cr,cg,cb,cur
end
Originally Posted by Kilock
After reading my way through the thread and even having a dabble at doing it my self (which simply left Pitbull looking at me as if to say " um, no.") I need to swallow my pride and admit I really need help. You may scoff but I'm completely stumped by:
[Status or [if IsMaxHP then
HP:Hide(MaxHP)
else
HP:VeryShort " . " PercentHP:Percent
end]]
and
[Status or [if IsMaxHP then
HP:Hide(MaxHP)
else
HP:Short
end]]
I know if someone can translate that in to LUA for me I'd have a rough idea, via comparison, on what I'm not picking up on. 
|
local s=Satus(unit)
if s then
return s
else
local cur,max=HP(unit),MaxHP(unit)
if cur~=max then
return "%s . %s%%",VeryShort(cur,true),Percent(cur,max)
end
end
and
local s=Satus(unit)
if s then
return s
else
local cur,max=HP(unit),MaxHP(unit)
if cur~=max then
return "%s",Short(cur,true)
end
end
|
correlation =/= causation
|
|
|
08/05/09, 5:39 PM
|
#146
|
|
Von Kaiser
|
help needed
I have searched this thread and I am still a noob at luatext and coding. I tried to figure out how to add health and name to my raid frames at the same time. I basically would like to get this dogtag and get the luatext for it if at all possible
[if InCombat then
(-MissingHP):Hide(0):ClassColor
else
Name:Truncate(5, nil):ClassColor
end]
I am not sure on how to achieve this and any help is greatly appreciated  Thank you again.
|
|
|
|
|
08/08/09, 6:34 PM
|
#147
|
|
Glass Joe
Stukka
Human Warrior
Winterhoof
|
Health Texts
Hello, I am trying to setup my health text and power text to show up as something like this:
10.5k | 14.5k
I have tried all of the default options and screwing around with the code myself. I am an amatuer coder myself so that probably doesn't help. Maybe im just stupid and missed the function i need to use or something who knows. So if some one could please help me i would very much appreciate it.
|
|
|
|
|
08/08/09, 10:43 PM
|
#148
|
|
Great Tiger
|
return "%s | %s",Short(HP(unit),true),Short(Power(unit),true)
Then check these on in Events: - UNIT_DISPLAYPOWER
- UNIT_HEALTH
- UNIT_FOCUS
- UNIT_ENERGY
- UNIT_MANA
- UNIT_RAGE
- UNIT_RUNIC_POWER
|
|
|
|
|
08/08/09, 11:30 PM
|
#149
|
|
Glass Joe
Stukka
Human Warrior
Winterhoof
|
I guess i should have explained it a little better. Thanks for your help though so far. I had something like that working temporary but what i actually want is something like this
10.4k | 10.4k_________________________________18.5k | 18.5k
current and max power_______________________current and max health
Ignore the underscores of course.
I did it before with the old pit bull but I'm having a hell of a time trying to figure it out in the new system.
thanks again sneep
|
|
|
|
|
08/09/09, 12:04 PM
|
#150
|
|
Great Tiger
|
Oh, that's as easy. I'm guessing you want them as separate texts?
Health:
return "%s | %s",Short(HP(unit),true),Short(MaxHP(unit),true)
Power:
if MaxPower(unit) > 0 then
return "%s | %s",Short(Power(unit),true),Short(MaxPower(unit),true)
end
|
|
|
|
|
|