• 0

    posted a message on LuaTexts Official Thread
    I made a minor change to fix an error that I have no clue how I made. If it still doesn't work try using Bugsack or something to give me the first few lines of the error.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from RiddellR
    Text that shows a players class and level (in the format of "[80] Death Knight") and colors the level by difficulty and class by it's corresponding class-color OR if it's a mob- displays whether it is a "Boss, "Elite", "Rare" or a "Rare-Elite" as well as having its level colored by difficulty and the elite/rare bit, well, default (in the format of "[81] Elite") and if it is a mob that isn't rare or elite just displays its level and colors it by difficulty (format of "[80]")
    Both of these versions should work. The first is simpler, but will look funny if the text is right-aligned. On the other hand the second has some extra complications but will right-align properly, if needed.

    local lvl=Level(unit)
    local dr,dg,db=DifficultyColor(unit)
    if UnitIsPlayer(unit) then
     local class=Class(unit)
     local cr,cg,cb=ClassColor(unit)
     return "|cff%02x%02x%02x[%s]|r |cff%02x%02x%02x%s|r",dr,dg,db,lvl,cr,cg,cb,class
    else
     local class=Classification(unit)
     return "|cff%02x%02x%02x[%s] %s",dr,dg,db,lvl,class or ''
    end


    local lvl=Level(unit)
    local dr,dg,db=DifficultyColor(unit)
    if UnitIsPlayer(unit) then
     local class=Class(unit)
     local cr,cg,cb=ClassColor(unit)
     return "|cff%02x%02x%02x[%s]|r |cff%02x%02x%02x%s|r",dr,dg,db,lvl,cr,cg,cb,class
    else
     local class=Classification(unit)
     if class then
     return "|cff%02x%02x%02x[%s] %s",dr,dg,db,lvl,class
     else
     return "|cff%02x%02x%02x[%s] %s",dr,dg,db,lvl
    end


    Lastly, How would i go about getting health% (default LUA text) just showing "Dead" instead of Dead xx

    if UnitIsDead(unit) then
     return Dead
    else
     ....
    end
    The .... is the standard tag, I am not at a WoW computer so I can't look at the exact code to make a cleaner version, but this should work.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    johnybenson: give us the current code so I can know what you expect the output to look like, beyond number formatting.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from Panga71
    I would like it to show nothing at all if full health until mouseover , then show only current health.
    When not full health , show health deficiency , then on mouseover , show only current/max health.


    local cur,max=HP(unit),MaxHP(unit)
    local miss=max-cur
    if miss==0 then
     if IsMouseOver() then
      return cur
     end
    else
     if IsMouseOver() then
      return "%s/%s",cur,max
     else
      return "-%s",miss
     end
    end
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    This would be possible by accessing libs, which are currently already packaged with pitbull4. However, I have no clue how to do so.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    I edited the tag to something closer to what I use (I do AFK/DND status separately from other status)

    I don't use Status anywhere, and that was my problem, I was under the impression that it showed AFK/DND times if they were available, but that is actually AFK() and DND().
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    The second thing I wrote will show the time, if the data is available. If the data isn't it will still say AFK or DND if appropriate.

    Status() will not return AFK or DND if it cannot ascertain the time. I don't like that, since not all units will give a time for you, but I still want to know if they are AFK or DND.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    I just added a %s within the quotes (creating another string output) and "s or '' ", at the end of each line. This won't give you the proper output for a lot of afk/dnd cases, because Status doesn't really return those very well.
    local s = Status(unit)
    local dr,dg,db = DifficultyColor(unit)
    local lvl = Level(unit)
    local name = Name(unit)
    if UnitIsPlayer(unit) then
     local cr,cg,cb = ClassColor(unit)
     local form = DruidForm(unit)
     if form then
      form = strsub(form,1,1)
      return "|cff%02x%02x%02x%s|r |cff%02x%02x%02x%s (%s)|r %s" ,dr,dg,db,lvl,cr,cg,cb,name,form,s or ''
     else
      return "|cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r %s" ,dr,dg,db,lvl,cr,cg,cb,name,s or ''
     end
    else
     local classif = Classification(unit)
     if classif then
      return "|cff%02x%02x%02x%s %s|r %s %s" ,dr,dg,db,lvl,classif,name,s or ''
     else
       return "|cff%02x%02x%02x%s|r %s %s" ,dr,dg,db,lvl,name,s or ''
     end
    end
    The other option is to just have to tags sitting right next to eachother (you can place two texts in the same location, and just tell them the order.
    local s = Status(unit)
    if s then
     return s
    elseif UnitIsAFK(unit) then
     return '%s',AFK(unit) or 'AFK'
    elseif UnitIsDND(unit) then
     return '%s',DND(unit) or 'DND'
    end
    The reason for these complex AFK and DND checks is that non-party members will not have good returns to AFK and DND via AFK() or DND().
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Kelem: can you explain what you want your output to look like. There are a tremendous number of ways that status could be added to this code.

    Also, try using the [code] tag to make your code easier to read on the forums.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from Stukka
    Currently it shows as 5469 | 5469 for the cur and max. Where as i would prefer if i could make it show as 5.47k | 5.47k. Is that even possible? Maybe i am missing something?
    Whoops, I am out of practice since I wasn't doing this stuff for a while since I was on vacation.
    local cur,max=HP(unit),MaxHP(unit)
    if max > 9999 then
     if cur > 9999 then
      return "|cff33cc66%s|r || |cff33cc66%s|r", Short(cur,true),Short(max,true)
     elseif cur > 999 then
      return "|cff33cc66%.2fk|r || |cff33cc66%s|r", cur/1000,Short(max,true)
     else
      return "|cff33cc66%s|r || |cff33cc66%s|r", cur,Short(max,true)
     end
    elseif max > 999 then
     if cur > 999 then
      return "|cff33cc66%.2fk|r || |cff33cc66%.2fk|r", cur/1000,max/1000
     else
      return "|cff33cc66%s|r || |cff33cc66%.2fk|r", cur,max/1000
     end
    else
     return "|cff33cc66%s|r || |cff33cc66%s|r", cur,max
    end
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    @ohidosee I posted the exact same thing in the EJ thread, but for community sharing here it is again:

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

    posted a message on LuaTexts Official Thread
    Quote from Stukka
    return "|cff33cc66%s|r || |cff33cc66%s|r", Short(HP(unit),true),Short(MaxHP(unit),true)

    modified Short() #### -> #.##k
    local cur,max=HP(unit),MaxHP(unit)
    if max > 9999 then
     if cur > 9999 then
      return "|cff33cc66%s|r || |cff33cc66%s|r", Short(cur,true),Short(max,true)
     elseif cur > 999 then
      return "|cff33cc66%.2fk|r || |cff33cc66%s|r", cur/1000,Short(max,true)
     else
      return "|cff33cc66%s|r || |cff33cc66%s|r", cur,Short(max,true)
     end
    elseif max > 999 then
     if cur > 999 then
      return "|cff33cc66%.2fk|r || |cff33cc66%.2fk|r", cur/1000,max/1000
     else
      return "|cff33cc66%s|r || |cff33cc66%.2fk|r", cur,max/1000
     end
    else
     return "|cff33cc66%s|r || |cff33cc66%s|r", cur,max
    end
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    putting false in the Short() tag (or omiting true) will return the formating, but not the number. You would only want to do that for testing purposes.

    Short(input,true) returns a four digit number in all possible situations (not counting "." as a character")

    10 > input - #
    100 > input > 9 - ##
    1000 > input > 99 - ###
    10000 > input > 999 - ####
    100000 > input > 9999 - ##.#k
    1000000 > input > 99999 - ###k
    10000000 > input > 999999 - #.##M
    100000000 > input > 9999999 - ##.#M
    1000000000 > input > 99999999 - ###M
    etc.

    "10000 > input > 999 - ####" is the most commonly modified output, #.##k is often created and you can find numerous examples of such in this thread.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from dlf1987
    Thanks, though i should have been more clear... Is there a way to do it through a custom lua? like, only show xp for self or something.

    surround your current tag with this:
    if unit=='player' then
    ....
    end
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Tippii: The resurrection part isn't really possible. It would require a res lib of sorts. but the other part is as follows:
    if UnitIsDead(unit) then
     return "Dead"
    else
     local cur,max=HP(unit),MaxHP(unit)
     retun "%s/%s",cur,max"
    end
    Posted in: Unit Frames
  • To post a comment, please or register a new account.