- Registered User
Member for 10 years, 4 months, and 30 days
Last active Fri, Oct, 4 2013 14:35:15
- 0 Followers
- 13 Total Posts
- 0 Thanks
Apr 29, 2011Posted in: Unit FramesQuote from jcaHi fellow forumusers.
I got this problem, i dont know how to edit lua text. I am a noob at it so i am turing to you here at wowace.
I want to put 2 lua texts in to one
the "return" statement causes execution to stop and the stuff after the return is given to the caller. So by putting a return at the beginning of your text, you're causing it to skip all the following code.
You can either use some temporary strings, or make the four format statements more complicated.
Apr 29, 2011Posted in: Unit FramesQuote from fengor1Hi there,
I am trying to do something that should be quite simple but not sure how to do it exactly. I have 2 separate LUA texts for %HP and %Power:
All I want to do is round the returned values down to 0 decimal places, so instead of say 82.3% it shows 82%.
After checking the lua texts sticky I think I need to use the function:
But as I said, i'm not sure howto assemble the syntax using my specific lua texts.
Anyone able to help? Thanks.
Lots of ways to attack this. But since you want to display an int, I'd do this:
Apr 29, 2011Posted in: Unit Frames
As this was posted 3 months ago, this probably isn't useful to the original poster... but I don't see an answer given. Just check for 0 and return an empty string (or return nothing at all):Quote from ausmaraI've been trying for days to think of a way to do this. What I want to do is hide a value of 0 for my Pitbull Vengeance Text.
local currentVengance = Vengance(unit) local maxVengance = VenganceMax(unit) local p = currentVengance / maxVengance * 100 return "%d", currentVengance, p
That's the Vengeance text I use, and I can't figure out anyway to not have it show a value of 0 (It just looks weird sitting at 0 on my bar)
I took out the maxVengeance 'return' since I just want the actual vengeance value
local currentVengance = Vengance(unit) if ( currentVengance and currentVengance > 0 ) then return "%d", currentVengance end
I also removed p since you didn't give it an entry in the format string (so it shouldn't have been doing anything.)
Sep 23, 2010Posted in: Unit Frames
"else" definitely works and is much more legible. Now that you've found some other bugs that would have prevented it from working, I don't want you to go on believing else was at fault! (Note that if you want an else if, it's "elseif" in lua. The syntax error from "else if" is not helpful, either.)Quote from SempreThis doesn't work for me unfortunately, the missing hp never replaces the name, no matter how much damage I've taken.
if max then return "%s", strsub(Name(unit), 1, 3) end
To expand a bit on what Kerecha said, this doesn't do what you were expecting. "if max then" is equivalent to
if max ~= nil and (type(max) ~= "boolean" or max == true) then
Since max was always a "number", your conditional was always true. As a C++ programmer, I made that mistake a lot
Sep 22, 2010Sempre: You're really close! You just need an else in there:Posted in: Unit Frames
local cur, max = HP(unit), MaxHP(unit) local miss = max - cur if miss ~=0 then return VeryShort(-miss) else return "%s", strsub(Name(unit), 1, 3) end
Sep 20, 2010Sempre, You're asking for a lot of things and I can't figure out what you want help with. Do you need to know how string manipulation works in LUA? I thought the very short missing hp was already a default text, so you could see how that is done.Posted in: Unit Frames
Sep 20, 2010Posted in: Unit FramesQuote from KerechaI could use a quick bit of help.
Getting tired of fail DK tanks not being in the proper presence so i was hoping to get some help making a tag to display a single letter denoting what presence the DK is using (Blood/Unholy/Frost) so i know when to hold back and when to nag at tank ;p
Heh, cute. (Shame we can't do that for warriors!) The basis for this text is the function UnitAura. I also went ahead and color-coded the letter. (The following code is untested, but is copied from code that works.)
local text = "" if UnitAura(unit, "Unholy Presence") ~= nil then text = text .. format("|cff80ff80%s|r", "U") end if UnitAura(unit, "Blood Presence") ~= nil then text = text .. format("|cffff8080%s|r", "B") end if UnitAura(unit, "Frost Presence") ~= nil then text = text .. format("|cff8080ff%s|r", "F") end return text
Make sure the text is registered for UNIT_AURA. You should be able to see how to add Righteous Fury to that list, too :)
Jul 22, 2010Posted in: Unit Frames
Like "Twlight Vanquisher Foo"? Use UnitPVPName instead of Name.Quote from CobraA1Is it possible to add titles to the names? Can't figure out how to do it.
Yep, use UnitInRaid, it returns the 1-40 index of where the unit is in the raid. (better than looping through them all like in the above example.)Quote from CobraA1For raids and battlegrounds where there are multiple groups, is it possible to list my group number next to my name?
Jul 16, 2010Posted in: Unit FramesQuote from MilanhThis is for my raid frames. I want the Name to be shown in class colours and any name longer than 12 letters to be be abbreviated. (sometimes vehicles have very long names and they go beyond my raid frames).
In addition how would I have one or two spaces before the name as the names are too close to the edge of the Unit frame.
Adapted from code on PlusHeal.com
local class_color = "" local _, class = UnitClass(unit) if class then local t = PitBull4.ClassColors[class] local r,g,b = t*255, t*255, t*255 class_color = ("|cff%02x%02x%02x"):format(r,g,b) end local short_name = Name(unit):sub(1,12) return " %s%s|r",class_color,short_name
Feb 1, 2010I've been working on some map position-based stuff for healing frames, and figured it would make sense for there to be a lib managing the map scales and some distance caching. My current little prototype provides position, distance, number in range, and a chain heal "guess". Is this something you guys would be on board with using in DXE and contributing to?Posted in: Raid AddOns
- To post a comment, please login or register a new account.