• 0

    posted a message on LuaTexts Official Thread
    Perfect now, thank you!
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Didn't understand what you meant but then I realised I had just explained the problem really poorly. What is actually happening is that one of <AFK> or <DND> will NEVER show by itself, I get that you can't be both away and busy. This is controlled by whatever condition comes first in the (afk or dnd) section. Swap them and the one that displays swaps.

    Using the line

    return "%s %s%s%s",HP(unit),Angle(dnd or afk)


    I can type /dnd and the <DND> tag will appear.
    After clearing dnd, I can type /afk and the <AFK> tag will not appear.
    If I type /dnd and /afk after, the <DND> will disappear and not be replaced by <AFK>.

    Got screenshots when using the line

    return "%s %s%s%s",HP(unit),Angle(afk or dnd)


    I can type /afk and the <AFK> tag will appear. http://i.imgur.com/fK5n2.jpg
    After clearing afk, I can type /dnd and the <DND> tag will not appear. http://i.imgur.com/gKpwi.jpg
    If I type /afk and /dnd after, the <AFK> will disappear and not be replaced by <DND>.
    http://i.imgur.com/7SLCs.jpg

    I'm using the PLAYER_FLAGS_CHANGED, UNIT_AURA, UNIT_HEALTH, UNIT_MAXHEALTH, UNIT_NAME_UPDATE events.

    Hopefully that clears up what's going on.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    I actually found that post when googling in an attempt to see if it had already been reported. Seemed a bit weird that a bug would occur and people wouldn't notice it for 14 months.

    Awesome, thanks for the fix and everything.

    EDIT: Updated my PB and the bug is gone and at least either AFK or DND will show, but never both. I can control which one displays by changing the order of afk or dnd in this last line

    return "%s %s%s%s",HP(unit),Angle(dnd or afk)


    but it only shows whichever is displayed first, in the above case, that's <DND>. I can fraps it if you need to see it in action.

    Sorry to keep bugging you with this ;(
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from Shefki
    I shouldn't have used AFKDuration(unit) and obviously DNDDuration(unit) doesn't exist. Should have used:
    IsAFK(unit) and IsDND(unit)
    respectively. Sorry.


    Haha, no need to say sorry, I wouldn't ever get this worked out without experienced help.

    Switching AFKDuration(unit) and DNDDuration(unit) for IsAFK(unit) and IsDND(unit) returns this though..

    Message: Interface\AddOns\PitBull4_LuaTexts\ScriptEnv.lua:328: attempt to index global 'dnd_times' (a nil value)
    Time: 11/04/10 03:35:48
    Count: 5
    Stack: Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:752: in function <Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:707>
    Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:1272: in function `AddFontString'
    ...ddOns\PitBull4\ModuleHandling\TextProviderModule.lua:118: in function `UpdateFrame'
    ...ddOns\PitBull4\ModuleHandling\TextProviderModule.lua:150: in function `ForceTextUpdate'
    Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:1344: in function <Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:1340>
    Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:1414: in function <Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:1410>
    (tail call): ?
    [C]: ?
    [string "safecall Dispatcher[2]"]:9: in function <[string "safecall Dispatcher[2]"]:5>
    (tail call): ?
    ...nfig-3.0\AceConfigDialog-3.0\AceConfigDialog-3.0.lua:797: in function <...nfig-3.0\AceConfigDialog-3.0\AceConfigDialog-3.0.lua:612>
    (tail call): ?
    [C]: ?
    [string "safecall Dispatcher[3]"]:9: in function <[string "safecall Dispatcher[3]"]:5>
    (tail call): ?
    ...nterface\AddOns\Aloft\Libs\AceGUI-3.0\AceGUI-3.0.lua:314: in function `Fire'
    ...AceGUI-3.0\widgets\AceGUIWidget-MultiLineEditBox.lua:44: in function <...AceGUI-3.0\widgets\AceGUIWidget-MultiLineEditBox.lua:41>

    Locals: <none>
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from Shefki
    local afk = AFKDuration(unit) and 'AFK' or ''
    local dnd = DNDDuration(unit) and 'DND' or ''
    local s = Status(unit)
    if s then
      return "%s %s%s%s",s,Angle(afk or dnd)
    end
    return "%s %s%s%s",HP(unit),Angle(afk or dnd)


    Actually just tested this again and the DND doesn't show (DNDDuration(unit) also gives an error, switched both AFK and DND to AFK(unit) and DND(unit) and it went away), not sure what's up :/

    Message: [string "PitBull4_LuaTexts:Player:test"]:2: attempt to call global 'DNDDuration' (a nil value)
    Time: 11/02/10 15:27:57
    Count: 1
    Stack: Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:752: in function <Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:707>
    Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:1272: in function `AddFontString'
    ...ddOns\PitBull4\ModuleHandling\TextProviderModule.lua:118: in function `UpdateFrame'
    ...ddOns\PitBull4\ModuleHandling\TextProviderModule.lua:150: in function `ForceTextUpdate'
    Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:1344: in function <Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:1340>
    Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:1414: in function <Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:1410>
    (tail call): ?
    [C]: ?
    [string "safecall Dispatcher[2]"]:9: in function <[string "safecall Dispatcher[2]"]:5>
    (tail call): ?
    ...nfig-3.0\AceConfigDialog-3.0\AceConfigDialog-3.0.lua:797: in function <...nfig-3.0\AceConfigDialog-3.0\AceConfigDialog-3.0.lua:612>
    (tail call): ?
    [C]: ?
    [string "safecall Dispatcher[3]"]:9: in function <[string "safecall Dispatcher[3]"]:5>
    (tail call): ?
    ...nterface\AddOns\Aloft\Libs\AceGUI-3.0\AceGUI-3.0.lua:314: in function `Fire'
    ...AceGUI-3.0\widgets\AceGUIWidget-MultiLineEditBox.lua:44: in function <...AceGUI-3.0\widgets\AceGUIWidget-MultiLineEditBox.lua:41>

    Locals: <none>
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from Shefki
    local s = Status(unit)
    if s then
      return "%s %s%s%s",s,Angle(AFK(unit) or DND(unit))
    end
    return "%s %s%s%s",HP(unit),Angle(AFK(unit) or DND(unit))
    


    This works great but I'd prefer to hide the timers so I just have the letters AFK, is that at all possible?
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Totally forgot about this thread! Thank you for the equals explanation Kerecha and Starinnia.

    Anyways, this is my simple health text

    local s = Status(unit)
    if s then
      return s
    end
      return "%s",HP(unit)


    I want to show AFK and DND indicators but I couldn't get it to work as the HP would never display next to it. How do I check for AFK/DND and then return AFK/DND with the HP/status text?
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from Kitjan
    Since max was always a "number", your conditional was always true. As a C++ programmer, I made that mistake a lot


    In retrospect, what you've said is actually pretty obvious and it makes total sense, I can only say the reason why I tried values that I didn't even expect to work was down to not knowing how to check for something like maximum HP. Thank you for your explanation.

    Quote from Sempre
    Managed to create the following which shows me my name and afk/dnd but only the names of other people.

    local afk, dnd = AFK(unit), DND(unit)
    if afk then
      return "a %s", strsub(Name(unit), 1, 24)
    end
    if dnd then
      return "b %s", strsub(Name(unit), 1, 24)
    end
      return "%s", strsub(Name(unit), 1, 24)


    Anyone able to help with this?
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    I actually only use absolute hp/status and mana on most frames. I just add little afk/dnd texts for group frames so I know if someone is slacking really.

    Is there a way to show text as a single letter using lua? I basically want to show afk/dnd as a single letter, the duration doesn't matter to me that much.

    Managed to create the following which shows me my name and afk/dnd but only the names of other people.

    local afk, dnd = AFK(unit), DND(unit)
    if afk then
      return "a %s", strsub(Name(unit), 1, 24)
    end
    if dnd then
      return "b %s", strsub(Name(unit), 1, 24)
    end
      return "%s", strsub(Name(unit), 1, 24)
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    I had it set to UNIT_HEALTH. Changed it to something completely different and back, relogged and everything works! Thanks for the reminder ;-)

    Now I need to work out how to add AFK/DND notifications through lua, however I need it to display next to the abbreviated name instead of replacing it. No idea where to start :|

    Also wondering..

    Quote from Kerecha
    Your not actually comparing the max to anything you would have to do "if cur == max then" afaik


    Why do we use == and not a single equals sign?
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    I actually just noticed something. The text doesn't update AT ALL. It only switches to the correct value after I /reloadui or refresh the game in some other way.

    This is not the case with all texts, just this one. I am clueless as to what is causing this.
    Posted in: Unit Frames
  • 0

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


    This doesn't work for me unfortunately, the missing hp never replaces the name, no matter how much damage I've taken.

    Quote from Kerecha

    sett the locals
    if statement to check if max HP
    then show name
    end
    if miss ~=0 (missing not 0)
    then show missing
    end


    I think I got all of these except checking if the unit is at max HP.

    local cur, max = HP(unit), MaxHP(unit)
    local miss = max - cur
    if max then
      return "%s", strsub(Name(unit), 1, 3)
    end
    if miss ~=0 then
      return VeryShort(-miss)
    end


    This didn't give me any errors but as above, it never displayed the hp, just the name.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Thanks Kerecha, managed to get the shortened hp. Now I want to join these..

    local cur, max = HP(unit), MaxHP(unit)
    local miss = max - cur
    if miss ~=0 then
    return VeryShort(-miss)

    and

    return "%s", strsub(Name(unit), 1, 3)

    ..so that the first three characters of the unit's name is shown if the target hasn't lost any hp. Tried using 'else' and some other things but they just returned error messages. What do I need to add?
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from Kitjan
    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.


    These are all for PB4. I could manage to create single parts of the things I asked for, but I couldn't put them together successfully, or, in the case of the hp text, I could not limit it to a few digits. These are things I would like to have in one text option so that they will either appear together or will only under certain conditions.

    Plainly, I was unable to create these texts because I lack the knowledge to do so.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Looking to get help with some texts I just couldn't work out on my own..

    1. AFK as 'A' or DND as 'B' and name shortened to 15 letters. DogTag equivalent I use is [(AFK ? 'A ') (DND ? 'B ') Name:Truncate(15, nil)]. Would appear as 'A Name' if AFK or just 'Name' if neither AFK/DND (Away/Busy now because of RealID).

    2. Same as above but with (Status or HP) instead of the name.

    3. AFK as 'A' or DND as 'B' and MissingHP or name abbreviated to 15 letters. DogTag version is [(AFK ? 'A ') (DND ? 'B ')] [(-MissingHP):Hide(0) or Name:Truncate(15, nil)].

    4. Same as above but no AFK or DND, 'very short' MissingHP (i.e. -16k instead of -16,209) and name reduced to 3 letters.

    If anyone could create these, that would be great! I can provide more detail if needed.
    Posted in: Unit Frames
  • To post a comment, please or register a new account.