1. #1

    Shortened numbers with WeakAuras

    Hello everyone,
    i use WeakAuras to track the potency of my ignite.
    In the Display-Tab i have entered %s in the Text-field.

    My "problem" is that this shows me the full number (for example 12345).
    Is it possible to show this number in a short way like 12(k) ?

    Thank you in advance <3

  2. #2
    Yes it is. Write %c in the text field instead and put this function into the text editor:
    Code:
    function () 
        
        local name,_,icon,_,_,_,_,_,_,_,_,_,_,_,value=UnitBuff("player", "Ignite")
        if(value > 999999) then value = math.floor(value/1000000) .. "M" end
        if(value > 999) then value = math.floor(value/1000) .. "k" end
        return(value)
    end
    123 will still display as 123
    12345 will display as 12k
    1234567 will display as 1M, which might not be of much interest when it comes to ignite but perhaps usable for other buffs.

  3. #3
    Thank you for your answer but unfortunately when i paste this into the code box i get this lua error:

    Message: [string "return function () ..."]:4: attempt to compare number with nil
    Time: 08/03/13 21:58:02
    Count: 6660
    Stack: [C]: ?
    [string "return function () ..."]:4: in function <[string "return function () ..."]:1>
    Interface\AddOns\WeakAuras\RegionTypes\icon.lua:208: in function `UpdateCustomText'
    Interface\AddOns\WeakAuras\WeakAuras.lua:4967: in function <Interface\AddOns\WeakAuras\WeakAuras.lua:4963>

  4. #4
    between line 3 and 4 add a new line
    Code:
    value=value or 0

  5. #5
    That fixed the lua error but the number is always zero now.
    Maybe there is an error getting the value?

    Im very bad at lua but the thing with ignite is that you have to get the size via the tooltip. Maybe that is the problem?
    Other than that its a debuff on my target. Maybe thats the issue since it says "player" in the code?

    Im totally clueless :P

  6. #6
    Quote Originally Posted by turtlefreak View Post
    Other than that its a debuff on my target. Maybe thats the issue since it says "player" in the code?
    That should be "target". Other than that, code looks good at first glance.
    UI & AddOns expert | Interface & Macros moderator - My work

  7. #7
    It's probably because you need to use UnitDebuff or UnitAura instead of UnitBuff. You should also add a PLAYER filter otherwise you're going to see whacky things with other fire mages in the raid.
    Code:
    function ()
        local value = select(15, UnitDebuff("target", "Ignite", nil, "PLAYER")) or 0
        if value > 999999 then
            value = math.floor(value/1000000) .. "m"
        elseif value > 999 then
            value = math.floor(value/1000) .. "k"
        end
        return value
    end

    Feral Druid Maintainer of SimC // Moderator at Fluid Druid forums
    Pawkets' Armory
    // Pawkets' Pro Raiders // <Forgotten Aspects>

  8. #8
    Alright, I should stop saying "it looks fine" without really reading the code thoroughly.
    UI & AddOns expert | Interface & Macros moderator - My work

  9. #9
    thank you so much everyone, the code aggixx posted works like a charm
    Last edited by turtlefreak; 2013-08-05 at 12:53 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •