• 0

    posted a message on LuaTexts Official Thread
    I think you want UnitCastingInfo and UnitChannelInfo. You want your text to listen to UNIT_SPELLCAST_START, UNIT_SPELLCAST_STOP, UNIT_SPELLCAST_CHANNEL_START, and UNIT_SPELLCAST_CHANNEL_STOP
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from jca
    Hi 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.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from fengor1
    Hi 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:

    return "%s%%",Percent(HP(unit),MaxHP(unit))

    and also

    return "%s%%",Percent(Power(unit),MaxPower(unit))

    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:

    Round(number,digits)

    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:
    return "%d%%",HP(unit)*100/MaxHP(unit)
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from ausmara
    I'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
    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):

    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.)
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from Sempre
    This doesn't work for me unfortunately, the missing hp never replaces the name, no matter how much damage I've taken.
    "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.)

    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
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Sempre: You're really close! You just need an else in there:

    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
    
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from Sirow
    Is there an (easy) way to add own PROVIDED_CODES (custom default texts) to LuaText?
    Seems like a good idea to me, maybe open a ticket for it?
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Sempre, 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
  • 0

    posted a message on LuaTexts Official Thread
    Quote from Kerecha
    I 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 :)
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from CobraA1
    Is it possible to add titles to the names? Can't figure out how to do it.
    Like "Twlight Vanquisher Foo"? Use UnitPVPName instead of Name.

    Quote from CobraA1
    For raids and battlegrounds where there are multiple groups, is it possible to list my group number next to my name?
    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.)
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from Milanh
    This 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[1]*255, t[2]*255, t[3]*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
    
    Posted in: Unit Frames
  • 0

    posted a message on Deus Vox Encounters
    I'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
  • 0

    posted a message on LuaTexts Official Thread
    Another resource for PB4 lua texts: http://www.plusheal.com/viewtopic.php?f=8&t=4123
    Posted in: Unit Frames
  • To post a comment, please or register a new account.