• 0

    posted a message on LuaTexts Official Thread
    Quote from pqee
    If it helps I've already made what you're working on. Only issue is when the powertype returns values I haven't included. I'm not sure when they'd be used. Like #5/Runes (when is this used?), #4/Happiness (when is this returned instead of 2/focus when used on hunter pets?), 7, 8 for vehicles.

    local cur, max, type = Power(unit), MaxPower(unit), UnitPowerType(unit)
    if type == 0 or type == 3 or type == 2 then
        if cur == max then
            return ''
        end
    elseif type == 1 or type == 6 then
        if cur == 0 then
            return ''
        end
    end
    return "%s/%s",Short(cur,true),Short(max,true)

    I made the following with a little inspiration from you
    if UnitIsDeadOrGhost(unit) ~= 1 then
        local type1, type2 = UnitPowerType(unit)
        if type1 == 1 or type1 == 6 then
    		local cur = Power(unit)
    		if cur > 0 then
    			local max = MaxPower(unit)
    			return "%s/%s %s",cur,max,type2
    		end
        elseif type1==0 or type1==2 or type1==3 then
    		local cur, max = Power(unit), MaxPower(unit)
    		if cur < max then 
    			return "%s/%s %s",cur,max,type2
    		end
    	end
    end
    
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from Kerecha
    Sounds like a great idea to me, gief some more advanced stuff i can "steal" for now since i just can't seem to find any material for studying .lua properly :p


    dunno if its advanced, but I'm making a text for:

    (current power)/(max power) (power type)
    hidden if (power type)=rage/runic and (current power)=0
    hidden if (power type)=mana/energy and (current power)=(max power)

    gotta start somewhere :)
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    maybe we should make a "interresting LuaText's" forum thread like the dogtag one. I would love to see what other people come up with, I were pretty good with dogtags, but I have not coded anything besides that, so this is a bit challenging.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from Shefki

    Working fine here, I'm guessing you haven't updated to the new PVPDuration(unit) function.

    you were right, PB wasnt updated.
    another isue:
    local max,cur,type = MaxPower(unit),Power(unit),UnitPowerType(unit)
    if type = 0 then
      return "%s/%s",cur,max
    end

    throws a {err} at me, is it just my code or?
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    is the dogtag [Zone] being resurrected in LuaTxt?

    and the
    local text = AFK(unit) or DND(unit)
    if not text then
    local pvp = PVPDuration(unit)
    if pvp then
    text = FormatDuration(pvp)
    end
    end
    if text then
    return "|cffff0000%s|r",text
    end

    you posted earlier is {err}'ing on me when not dnd/afk'ing

    keep up the good work :)
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    cant get Status(unit) to work (only tested on mobs) using the built in health absolute short.
    "local s = Status(unit)
    if s then
    return s
    end
    return "%s/%s",Short(HP(unit),true),Short(MaxHP(unit),true)"

    aka I killed a mob and it only showed up as (example) 0/324 where I would think it should be "Dead 0/324"
    Posted in: Unit Frames
  • To post a comment, please or register a new account.