• 0

    posted a message on LuaTexts Official Thread
    I think the problem was a missing option for when you are neither AFK or DND. I added that in here:
    local lvl = Level(unit)
    local name = Name(unit) 
    local cr,cg,cb = ClassColor(unit)
    return '|cff%02x%02x%02x%s|r %s %s',cr,cg,cb,lvl,name,AFK(unit) or DND(unit) or ''


    or

    local lvl = Level(unit)
    local name = Name(unit) 
    local cr,cg,cb = ClassColor(unit)
    return '|cff%02x%02x%02x%s|r %s %s',cr,cg,cb,lvl,name,AFK(unit) or (UnitIsAFK(unit) and "AFK") or DND(unit) or (UnitIsDND(unit) and "DND") or ''
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    This name 'ripping' seems to me to require a conditional based upon information you won't know.

    If you are targeting Verylongmob name1, there is no way to check how to shorten it based upon the theoretical existence of Verylongmob name2. You would have to create a NPC name database and use that to create truncations if you wanted 3rd party conditional truncation.

    Regarding the python comment, I do not know python, so I can't begin to remark on that.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from Kelem
    Also, somebody was trying to get a pet timer working, has that been figured out? (for summoned pets)


    local ptime = GetPetTimeRemaining()
    if ptime then
      UpdateIn(0.25)
      return floor(ptime/100+.5)/10
    end

    This displays rounded to the nearest 10th of a second.

    I set up the event PLAYER_PET_CHANGED, although it still doesn't work 100% of the time.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    In the first, I forgot to remove the class color aspect of the non-player portion

    In the third, I accidentally added an extra "%s"

    My original post should be correct now.

    Also, In general only the first two lines of the error is actually needed.

    [2009/06/30 20:14:54-353-x1]: PitBull4_LuaTexts:KTarget:Lua:Name caused the following error::
    bad argument #7 to 'SetFormattedText' (number expected, got nil):
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from Kelem

    Level(color/difficulty coded) Name (Form truncated to B C M T depending on druid form)
    Raid Group #
    Class by color, Race, Guild


    So this isn't exactly what you stated you want, but it's close. Better if anything.

    local dr,dg,db = DiificultyColor(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" ,dr,dg,db,lvl,cr,cg,cb,name,form
     else
      return "|cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r" ,dr,dg,db,lvl,cr,cg,cb,name
     end
    else
     local classif = Classification(unit)
     if classif then
      return "|cff%02x%02x%02x%s %s|r %s" ,dr,dg,db,lvl,classif,name
     else
      return "|cff%02x%02x%02x%s|r %s" ,dr,dg,db,lvl,name
     end
    end


    if UnitInRaid(unit) then
     local size = GetNumRaidMembers()
     local uname=Name(unit)
     i=1
     while i<=size do
      local name,_,subgroup = GetRaidRosterInfo(i)
      if uname==name then
       return "(%s)",subgroup
      end
      i=i+1
     end
    end


    local cr,cg,cb = ClassColor(unit)
    if UnitIsPlayer(unit) then
     local class = Class(unit)
    end
    local race = SmartRace(unit)
    local guild = GetGuildInfo(unit)
    return "|cff%02x%02x%02x%s|r %s %s",cr,cg,cb,class or "",race or "",guild or ""


    As for actually putting this in, you are going to need to use a Blank Space.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Guild only require tooltip scanning if it isn't actually a guild you are trying to get.

    For example, NPC titles.

    guildName, guildRankName, guildRankIndex = GetGuildInfo(unit)
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    I see what Kelem is saying. He wants the tags to change based on whether a VehicleSwap has occurred. This is possible to work around through LuaTexts that simply have both versions, and ask if the unit is a vehicle before deciding which to use.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Use what Shefki said. I was unaware that SeperateDigits had this capability.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from monkeh2
    The second kind is what I mean.
    shefki said it earlier, in response to my fail attempt to help you.
    return string.gsub(output,"(.)","%1\n")
    Just make replace output with the name of the string you are trying to output. If you are outputting something more complicated you still will just use that gsub call, but there is more too it.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from uhman
    UpdateIn() solves the problem for now even if its an unconventional way of doing it. It's something between guessing when something could have changed with the correspondent aura and setting the value that low that most updates are unnecessary.
    Just one question about this: does the tag get updated when the value it displays doesn't change? So when setting the UpdateIn_value to 0.01 would it create a new tag every 0.01secs or would it just check if something has changed and update when something has changed?
    It updates regardless. It won't know if something changed until after it updates :D.

    Quote from uhman
    yes it is attached to the player frame atm. But I also could think of attaching it to the target frame to track other priests' POM
    You'd have the same issue here, I think I said this earlier when I was helping you with the code to begin with. If you use pitbull4 for your raid frames, and attach a modified version of this tag to the raid frames, then the standard UNIT_AURA event would work fantastically.

    The issue is quite simply that UNIT_AURA in LuaText only updates the frame when the unit (in the frame which the tag is attached to) has a change in auras.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from Shefki
    Quote from uhman
    edit: Also in a raid environment sometimes the POM doesn't get tracked and I have no idea why this happens. I mean everytime that UNIT_AURA event fires it iterates over all raid member and over their buffs, so it shouldn't be possible that the algorithm misses a POM. Could this be a problem with the event itself or do I have to enable any other events besides UNIT_AURA?


    No that's not how UNIT_AURA works. UNIT_AURA says which unit had auras changed and it iterates over that units buffs. However every gain or loss of POM should trigger a UNIT_AURA for the relevant units.
    I have a guess why his POM tag isn't updating properly. From what I know of his code, I'd assume the tag is attached to his player frame. So the UNIT_AURA event would only cause an update when his auras change, since the LuaText event UNIT_AURA (versus the WoW Event UNIT_AURA) defaults to only cause an update to the LuaText when the unit returned by the UNIT_AURA event is the unit the tag is attached to. I know that if he were adding the event UNIT_AURA you could just check the 'all' box, but that probably isn't something you normally want for the UNIT_AURA event (would cause a tremendous amount of extra refreshes throughout your entire unitframes). If it is possible to have different update settings for different uses of the same WoW Event that would be the best solution I can think of.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from jahf
    Q: Is there any way to modify "Short()" to display "k" abbreviations -always-?

    Example: right now anything under 9999 is shown as 9999, I would like 9999 to always show as 9.9K (or preferably 9.99K).

    Something small like 999 would become ".999K", 99 would be ".099K", etc.
    This should work. Make sure to assign the number you want to 'value' or replace 'value' with the variable to be printed. Don't put a function in there for 'value' as you will be running the same function numerous times.
    if value >100000 then
     return "%sk", Round(value/1000,0)
    elseif value >10000 then
     return "%sk", Round(value/1000,1)
    elseif value >1000 then
     return "%sk", Round(value/1000,2)
    else
     return ".%03dk",value
    end
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from Shefki
    Why don't you just do:
    string.gsub(input,"(.)","%1\n")

    And just to be clear. If you want just to put characters between other characters you can do:
    string.gsub(input,"(.)","%1\n",#input - 1)

    Just change \n to be whatever the separator you want.
    Hrmm didn't know you could gsub with "(.)"
    I am mostly a lua nub, actually, I just have random beginner level coding experience so I know how to think if function writing mode.

    Quote from Shefki
    Bad sfan, forgot the local again:
    some day I will stop doing this...some day.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from Razumikhin
    [Name:Truncate(16, nil)] [(AFK or DND):Angle]

    local name = strsub(Name(unit),1,16)
    return '%s %s%s%s',name,Angle(AFK(unit) or DND(unit))
    Posted in: Unit Frames
  • 0

    posted a message on PitBull 4.0
    hrmm so I redid that code entirely.

    I generalized the function to deliminate by other strings ('.' for example).
    I also added the option to prepend the string with the deliminator (defaults to FALSE).
    local function sep.string(input,delim,prepend=FALSE)
        local length = #input
        local position = 2
        local output = strsub(input,1,1)
        while position <= length do
            output = output .. delim .. strsub(input, position, position)
            position = position + 1
        end
        if prepend then
            output = output .. delim
        end
        return output
    end

    sep.string(Name(unit),".",TRUE) ->
    H.o.t.a.n.

    sep.string(Name(unit),"\n") ->
    H
    o
    t
    a
    n
    Posted in: Unit Frames
  • To post a comment, please or register a new account.