Elitist Jerks
Register
Blogs
Urban Rivals
Forums
New Posts


Go Back   Elitist Jerks > Public Discussion > User Interface and AddOns
Elitist Jerks Login

gamerDNA Login

Welcome to Elitist Jerks
We're testing some new features on the site regarding OpenID registration and coordination with gamerDNA. If you experience any issues with registering an account, please take the time to fill out a report and send it to this e-mail address. We would appreciate any assistance you could provide in making sure everything is functioning as intended. Thanks!

If this is your first visit, please be sure to check out the FAQ and the forum rules. Users must register to post and new registrations are subject to a one day "mute" period to get acquainted with the community.

Reply
 
LinkBack (18) Thread Tools
Old 08/09/09, 4:07 PM   #151
Methyl
Glass Joe
 
Night Elf Hunter
 
Blood Furnace
The following LuaText displays one's current Attack Power, Crit%, Armor Pen and Hit Rating.
I've got one tiny issue with this one which I'd appreciate some insight on. I just can't seem to find the appropriate API function call to get one's total Attack Power. At the moment, I'm using "UnitRangedAttackPower("player")" but I've discovered that this call only returns one's base AP and not the total buffed AP. If anyone can shed some light on this one I'd appreciate it.

-- Stats

local ap,cr,arp,hr = UnitRangedAttackPower("player"), GetRangedCritChance(), GetCombatRating(25), GetCombatRating(7)
return "|cff94C7FAAP:%.0f \nCr:%.2f%% \nArP:%.0f HR:%.0f|r", ap,cr,arp,hr
I have been messing with this and i found that the UnitRangedAttackPower() out puts into an array and the way you are calling it you are only captures the 1st argument of said array.
--Stats

local base, posBuff, negBuff = UnitRangedAttackPower("player");
local ap = base + posBuff + negBuff;
local cr,arp,hr = GetRangedCritChance(), GetCombatRating(25), GetCombatRating(7)
return "|cff94C7FAAP:%.0f \nCr:%.2f%% \nArP:%.0f HR:%.0f|r", ap,cr,arp,hr
This one is what you are looking for in terms of adding someones total Ranged AP.
 
User is offline.
Reply With Quote
Old 08/09/09, 7:44 PM   #152
Stukka
Glass Joe
 
Stukka
Human Warrior
 
Winterhoof
Originally Posted by the SNEEP View Post
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


That didn't quite work as i mentioned here is how it shows up my health text is on the right side in the blank bar area. For some reason they way you said to do it doesn't show it as 5.4k | 5.4k. I would like it to be shown that way not 5469 | 5469. Ive tried everything and i can't figure it out what you showed doesn't seem to work? Thanks

this is how i would like it to look:


Last edited by Stukka : 08/09/09 at 7:59 PM.
 
User is offline.
Reply With Quote
Old 08/11/09, 12:57 AM   #153
Ohi
I have evil ovaries.
 
Ohi's Avatar
 
Gnome Mage
 
Thunderlord
Did a search, but didn't see anything in regard to this, so here goes.

I know with dogtags the following code will show ALL druid rejuv's. Is it possible with the new LUA text to show only your rejuvs (as well as lifebloom, etc.)?

[if HasAura('Rejuvenation') and (AuraDuration('Rejuvenation') >= 5) then 
   AuraDuration('Rejuvenation'):Floor:Green
elseif HasAura('Rejuvenation') and (AuraDuration('Rejuvenation') >= 0) then 
   AuraDuration('Rejuvenation'):Truncate(2,nil):Red
elseif HasAura('Rejuvenation') then 
'swiftmendable'
else ' '
end]
 
User is offline.
Reply With Quote
Old 08/11/09, 2:51 AM   #154
Hotan
Piston Honda
 
Hotan's Avatar
 
Gnome Mage
 
Dark Iron
Originally Posted by Ohi View Post
Did a search, but didn't see anything in regard to this, so here goes.

I know with dogtags the following code will show ALL druid rejuv's. Is it possible with the new LUA text to show only your rejuvs (as well as lifebloom, etc.)?

[if HasAura('Rejuvenation') and (AuraDuration('Rejuvenation') >= 5) then 
   AuraDuration('Rejuvenation'):Floor:Green
elseif HasAura('Rejuvenation') and (AuraDuration('Rejuvenation') >= 0) then 
   AuraDuration('Rejuvenation'):Truncate(2,nil):Red
elseif HasAura('Rejuvenation') then 
'swiftmendable'
else ' '
end]
I didn't include your 'swiftmendable' portion because I don't see how it is possible for that display to occur.
local i = 1
while true do
 local name,_,_,_,_,_,expires,caster = UnitAura(unit,i,"HELPFUL")
 if not name then
   break
 elseif name == "Rejuvination" and caster == "player" then
  local rem = GetTime() - expires
  if rem > 5 then
   local r,g,b = 0,255,0
  else
   local r,g,b = 255,0,0
  end
  return "|cff%02x%02x%02x%.1f|r",r,g,b,rem
  break
 end
 i=i+1
end

Last edited by Hotan : 08/11/09 at 2:25 PM. Reason: i=i+1

correlation =/= causation
 
User is offline.
Reply With Quote
Old 08/14/09, 11:14 AM   #155
Ferretmonger
Glass Joe
 
Ferretmonger's Avatar
 
Blood Elf Hunter
 
Karazhan (EU)
Originally Posted by Methyl View Post
I have been messing with this and i found that the UnitRangedAttackPower() out puts into an array and the way you are calling it you are only captures the 1st argument of said array.
--Stats

local base, posBuff, negBuff = UnitRangedAttackPower("player");
local ap = base + posBuff + negBuff;
local cr,arp,hr = GetRangedCritChance(), GetCombatRating(25), GetCombatRating(7)
return "|cff94C7FAAP:%.0f \nCr:%.2f%% \nArP:%.0f HR:%.0f|r", ap,cr,arp,hr
This one is what you are looking for in terms of adding someones total Ranged AP.
Thank you very much for the help, thought no one was gonna answer my question ^_^
 
User is offline.
Reply With Quote
Old 08/18/09, 2:25 PM   #156
fairkitty
Glass Joe
 
fairkitty's Avatar
 
Human Priest
 
<TM>
Dreadmaul
LuaTexts and Ownbuffs

I have noticed that there is nothing describing how to differentiate between buffs applied by yourself to those applied by other people.

I know that there is support for it in the wow interface but I am not sure on how to do this with the LuaTexts in PB4 (or if you can at all) and I have no experience with the new LuaTexts.

If anyone can give me any help in how to do it id greatly appreciate it.
 
User is offline.
Reply With Quote
Old 08/18/09, 4:49 PM   #157
Hamsda
Von Kaiser
 
Hamsda's Avatar
 
Troll Priest
 
Mannoroth (EU)
If you have a look at the API UnitAura at wowwiki, you'll see that it returns

unitCaster
String - unitId reference to the unit that casted the buff/debuff.
which you can compare to "player" to check if you casted a specific debuff.

Hope this helps!



Edit to avoid doublepost:
I have a problem with my % health display for my target.
local s = Status(unit)
if s then
  return s
end
local cur, max = HP(unit), MaxHP(unit)
local miss = cur - max 
if miss ~= 0 then
  if UnitIsFriend(unit,'player') then
    return "|cffff7f7f%s|r\124%s\124%s%%",Short(miss,true),Short(max,true),Round(Percent(cur,max),0)
  else
    return "%s/%s\124%s%%",Short(cur,true),Short(max,true),Round(Percent(cur,max),0)
  end
else
  return max
end
When the target gets to low %, I think it's either 5% or 0.5% (can't pay that much attention to it when fighting mobs with larger hp as a tank or healer), the % display kinda buggs out and looks like this:

Could someone explain me why this happens and how to fix it?

I experimented a bit more with the raptors and got the % display to vanish completely, leaving it with "33/800" or something like that for their hp. I'm getting really confused, but apparently I didn't understand the Round function fully.

Last edited by Hamsda : 08/18/09 at 5:20 PM.

There are only 10 types of people... those who understand binary and those who don't.
 
User is offline.
Reply With Quote
Old 08/18/09, 6:47 PM   #158
Hotan
Piston Honda
 
Hotan's Avatar
 
Gnome Mage
 
Dark Iron
@Hamsda: can you explain what this is supposed to return, I can't quite tell. The "\124" is foreign to me.

Originally Posted by fairkitty View Post
I have noticed that there is nothing describing how to differentiate between buffs applied by yourself to those applied by other people.

I know that there is support for it in the wow interface but I am not sure on how to do this with the LuaTexts in PB4 (or if you can at all) and I have no experience with the new LuaTexts.

If anyone can give me any help in how to do it id greatly appreciate it.
I can't give you too concrete of an example, but I can give the function and variable saving method to use.
local name,_,icon,_,_,_,_,caster = UnitAura(unit,i,"HARMFUL")
Replace "HARMFUL" with "HELPFUL" if you are looking for buffs. this is best (well really only) used in a loop (while is preferable)

Here is an example that shows the time left on Rejuv, with different colors based on the amount of time left:
local i = 1
while true do
 local name,_,icon,_,_,_,expires,caster = UnitAura(unit,i,"HELPFUL")
 if not name then
   break
 elseif name == "Rejuvination" and caster == "player" then
  UpdateIn(.1)
  local rem = GetTime() - expires
  if rem > 5 then
   local r,g,b = 0,255,0
  else
   local r,g,b = 255,0,0
  end
  return "|cff%02x%02x%02x%.1f|r",r,g,b,rem
  break
 end
 i=i+1
end
This example is fairly specified since I also was grabbing duration data from the UnitAura() call.

The return to caster will be a UnitID.

Last edited by Hotan : 08/20/09 at 2:16 AM. Reason: UpdateIn()

correlation =/= causation
 
User is offline.
Reply With Quote
Old 08/18/09, 8:39 PM   #159
Hamsda
Von Kaiser
 
Hamsda's Avatar
 
Troll Priest
 
Mannoroth (EU)
Originally Posted by Hotan View Post
@Hamsda: can you explain what this is supposed to return, I can't quite tell. The "\124" is foreign to me.
Sorry, forgot that^^ Should've posted a screen when it's working (basically everytime except for low%) :X

Already in bed with my laptop so no screen but I hope a short description will be enough.

\124 is just the escape sequence for "|"^^

For friendly units it looks like:
-3850|38,5k|90%
For enemies it's only:
1234/2468|50%
The missing hp on friendly targets displayed in a light red. I didn't test the behaviour on low% friendly targets but since it's the same return string, it should be the same problem...

Any help is greatly appreciated!


Edit: After seeing your luatext for Reju I got another question^^
A few hours ago I tried to put a simple tag on my target which shows the number of Blood Corruption stacks I have on it and it's time until expiration. The count was no problem but I couldn't get the expiration time to show correctly. Could you explain the logic behind GetTime() - expires from the UnitAura because I don't get it.
Thanks in advance.

There are only 10 types of people... those who understand binary and those who don't.
 
User is offline.
Reply With Quote
Old 08/18/09, 9:10 PM   #160
Hotan
Piston Honda
 
Hotan's Avatar
 
Gnome Mage
 
Dark Iron
Hamsda: You are better off using "||" than "\124" if for nothing else than readability.

I changed your way of rounding the Percent. %d rather than %s causes the output to be an interger, thus rounding it for you. I am actually unsure what is causing your return issue, but I do know that Round() isn't actually a lua function, so avoiding it is a good thing. Using Floor(x+.5) will cause the exact same result, but actually use lua functions.
local s = Status(unit)
if s then
  return s
end
local cur, max = HP(unit), MaxHP(unit)
local miss = cur - max 
if miss ~= 0 then
  if UnitIsFriend(unit,'player') then
    return "|cffff7f7f-%s|r||%s||%d%%",Short(miss,true),Short(max,true),Percent(cur,max)
  else
    return "%s/%s||%d%%",Short(cur,true),Short(max,true),Percent(cur,max)
  end
else
  return max
end
In a completely different line of thought, I like to remove the status and put that in a different tag; but that is a personal preference. I just don't want different status returns to hide the health return. This is a rare issue, mostly with friendly targets.

Remaining time stuff:
The return for expires in UnitAura() is a time measured as the time between when your computer was turned on and the time the aura will fade. GetTime() is the time measured between when your computer was turned on and right now. So, expires - GetTime() is the time remaining on the aura.
This would do the display you want, I got rid of the color since I am not sure if you wanted it, but it seems like you have the understanding to add it back in if I am incorrect. %.1f makes the time remaining display as a number with one decimal point (another method of rounding that you can use without lua functions at all)
local i = 1
while true do
 local name,_,_,count,_,_,expires,caster = UnitAura(unit,i,"HELPFUL")
 if not name then
   break
 elseif name == "Blood Corruption" and caster == "player" then
  UpdateIn(.1)
  local rem = expires - GetTime()
  return "%d||%.1f",count,rem
 end
 i=i+1
end

Last edited by Hotan : 08/20/09 at 2:19 AM. Reason: UpdateIn()

correlation =/= causation
 
User is offline.
Reply With Quote
Old 08/18/09, 9:33 PM   #161
Hamsda
Von Kaiser
 
Hamsda's Avatar
 
Troll Priest
 
Mannoroth (EU)
Thank you very much Hotan, I'll test your "improved" texts tomorrow and see if there are any errors left

Regarding the \124: I read on a page where I got my basic lua knowledge that this was a better way of handling escape sequences (can't remember why...) but if there is no disadvantage I'll gladly switch to using "||" instead because it is indeed better for reading the code.


Edit:
The health text works like a charm but the Blood Corruption text resulted in an error.
I had to remove the break in the 2nd if conditional and now it works

One question though: rem doesn't update, only if I refresh the Blood Corruption stack so it will always show as 15.0... I thought Unit_Aura would be enough for the text to update properly but apparently I have to activate something else but I don't know what

Last edited by Hamsda : 08/19/09 at 2:20 PM.

There are only 10 types of people... those who understand binary and those who don't.
 
User is offline.
Reply With Quote
Old 08/19/09, 10:03 PM   #162
ShadowEric
Piston Honda
 
Human Rogue
 
Terenas
Well if you have UNIT_AURA set as the event for this luatext and you try it solo, it will only run this code when a unit_aura event fires, which is only when a (de)buff changes. So that's why it will only refresh your text when you refresh your debuff, which fires the event.

Of course, in a raid, this will happen a lot more often and it will appear to refresh more often. In any case, for a stable timer, you want more than just unit_aura. I'm not sure you should be using luatext for timers anyway.
 
User is offline.
Reply With Quote
Old 08/19/09, 11:54 PM   #163
Hamsda
Von Kaiser
 
Hamsda's Avatar
 
Troll Priest
 
Mannoroth (EU)
I realized this when testing a bit with Thyrm today. Adding the 2 unithealth events helped to refresh when solo but I'll prolly stick just with a stack display and my timer from Quartz.

Thanks for the help anyways

There are only 10 types of people... those who understand binary and those who don't.
 
User is offline.
Reply With Quote
Old 08/20/09, 2:13 AM   #164
Hotan
Piston Honda
 
Hotan's Avatar
 
Gnome Mage
 
Dark Iron
Adding Unit_Health would technically work, but that is going to probably result in extra calls, and they will spike or lull depending on the situation.

You could add UpdateIn(x) where x is a number of seconds (or partial seconds). You would want to put this line just after the elseif, that way the Updates only happen if the buff is up there (UnitAura will happily begin the cycle for you)

PS: The UpdateIn() would probably be a good idea in the rejuv thing I posted also, I'll toss it in both.

edit: I'm not sure the error issue. Removing the break isn't a bad thing, it just results in extra UnitAura() calls since you will loop through every debuff rather than stopping when the relevant one is found.

Last edited by Hotan : 08/20/09 at 2:19 AM.

correlation =/= causation
 
User is offline.
Reply With Quote
Old 08/20/09, 6:19 AM   #165
fairkitty
Glass Joe
 
fairkitty's Avatar
 
Human Priest
 
<TM>
Dreadmaul
I tried the code today, It worked great I can see only my own buffs. Thankyou for your help
 
User is offline.
Reply With Quote
Old 08/20/09, 12:54 PM   #166
Hamsda
Von Kaiser
 
Hamsda's Avatar
 
Troll Priest
 
Mannoroth (EU)
Originally Posted by Hotan View Post
Adding Unit_Health would technically work, but that is going to probably result in extra calls, and they will spike or lull depending on the situation.

You could add UpdateIn(x) where x is a number of seconds (or partial seconds). You would want to put this line just after the elseif, that way the Updates only happen if the buff is up there (UnitAura will happily begin the cycle for you)

PS: The UpdateIn() would probably be a good idea in the rejuv thing I posted also, I'll toss it in both.

edit: I'm not sure the error issue. Removing the break isn't a bad thing, it just results in extra UnitAura() calls since you will loop through every debuff rather than stopping when the relevant one is found.
I knew about the UpdateIn(0.1) as an option to always update it but I didn't know how to place it inside a lua text. Thanks for clearing this one up
Removing the break and adding in Unit_Health or UpdateIn() won't make a great difference in my setting I believe because I still use Grid for raids (kinda lazy to switch to pb4 entirely and setup all the buffs/hots/debuffs I need) and mostly have a boss or mob targeted to flame the slacking debuffers via my other lua text :P

There are only 10 types of people... those who understand binary and those who don't.
 
User is offline.
Reply With Quote
Old 08/20/09, 10:50 PM   #167
Hamsda
Von Kaiser
 
Hamsda's Avatar
 
Troll Priest
 
Mannoroth (EU)
I couldn't really test it now, but I want to let people know it anyways if they don't use parrot:

add secondary condition "Lua function" to run custom lua-code for checks
from the new Parrot v1.9.0

This change should give some room for improvements one wants for the checks parrot has like showing a "Drain Life" only when the health treshold is matched and all other dots are still up as affliction or something like that. Time to get creative

There are only 10 types of people... those who understand binary and those who don't.
 
User is offline.
Reply With Quote
Old 08/21/09, 1:55 PM   #168
Vikolai
Glass Joe
 
Human Priest
 
Doomhammer (EU)
Hi there,

After much searching around, I found this handy DogTag;

Originally Posted by Belbo View Post

[if CanAttack(unit="target") and ((MaxRange > 0) and (MaxRange < 30)) then
"Back Up!":Yellow
elseif CanAttack(unit="target") and ((MaxRange >= 30) and (MaxRange < 45)) then
"Sniper Active":Green
elseif CanAttack(unit="target") then
"Get Closer!":Red
end]
...which I'd like to adapt to be a basic range check so I can finally be rid of my action bars. Obviously the range numbers and symbols shown are easy enough, but unfortunately I don't have the lua knowledge to convert this into something usable in my Pitbull frames. Can anyone help?
 
User is offline.
Reply With Quote
Old 08/24/09, 9:27 AM   #169
Celia4s
Glass Joe
 
Gnome Hunter
 
Alexstrasza (EU)
thanks
 
User is offline.
Reply With Quote
Old 08/26/09, 1:34 PM   #170
Negheos
Glass Joe
 
Night Elf Druid
 
Wrathbringer (EU)
So after some time of playing and learnig with the new luatext I have no more Ideas. I use Pitbull as a complete replacement for my unitframes and for Grid. If any of the Raidmembers sits in a vehicle the unitid (and the bars of course) is replaced by the vehicles unitid. This is what I want so please do not suggest to change these settings.

The problem: I would like the Name of each person sitting together in / alone in a vehicle to be displayed instead of the vehicles name.

The code: This is what I have done so far:
local cr,cg,cb = ClassColor(unit)
local name, namee = Name(unit), ""
local controlType, occupantName, occupantRealm, canEject, canSwitchSeats = UnitVehicleSeatInfo(unit,1)

if UnitExists(occupantName) then
    namee = string.sub (occupantName, 0,8)
    return "|cff00ff00%s|r",namee
else
    namee = string.sub (name, 0,8)
    return "|cff%02x%02x%02x%s|r",cr,cg,cb,namee
end
It works fine as you will see if you do not have two or more persons in ONE vehicle. If this is the case the name of the "root" of the vehicle will show up for all of the passengers.

Suggestions? I tried to "steal" the code from Grid but that doesn´t work out because of the Grid programming structure.

edit: code cleaned up.

Last edited by Negheos : 08/26/09 at 1:52 PM.
 
User is offline.
Reply With Quote
Old 09/02/09, 6:07 AM   #171
Negheos
Glass Joe
 
Night Elf Druid
 
Wrathbringer (EU)
So nobody has an idea how to solve my problem or is the thread dead already?
 
User is offline.
Reply With Quote
Old 09/02/09, 11:13 AM   #172
Hotan
Piston Honda
 
Hotan's Avatar
 
Gnome Mage
 
Dark Iron
Negheos: I don't believe the thread is dead, the issue is that your tag is extremely complicated and above the level of most of the people helping out in this thread (namely me). I might take a stab at it this Sunday when I am not busy (life has taken over my free time).

correlation =/= causation
 
User is offline.
Reply With Quote
Old 09/02/09, 5:39 PM   #173
Negheos
Glass Joe
 
Night Elf Druid
 
Wrathbringer (EU)
Would be nice if you could try to figure out how to do this - I really like the luatext idea and I think I´m already a bit into it but that seems to be way above my level...
 
User is offline.
Reply With Quote
Old 09/02/09, 9:45 PM   #174
Hotan
Piston Honda
 
Hotan's Avatar
 
Gnome Mage
 
Dark Iron
Negheos: In light of the changes to LuaText that Shefki announced on the wowace boards, I will very likely not touch this idea until after that. The fleeting ideas I have come up with for how to solve your conundrum more elegantly will all be leaps and strides easier with his modifications.

correlation =/= causation
 
User is offline.
Reply With Quote
Old 09/03/09, 6:12 AM   #175
Negheos
Glass Joe
 
Night Elf Druid
 
Wrathbringer (EU)
I agree with you. The changes will make many things easier. I´ll keep an eye on this thread
 
User is offline.
Reply With Quote
Reply

Go Back   Elitist Jerks > Public Discussion > User Interface and AddOns

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
The DogTags 3.0 Thread Trouble User Interface and AddOns 622 10/06/09 3:51 PM
[DogTags] - Share yours! Fulnir User Interface and AddOns 164 03/30/08 2:30 AM