1. #1
    Deleted

    Weak Auras custom progress string flooring and math

    Hi,

    Was just wondering if anyone knows how to make a custom string in WeakAuras that shows progress time of a debuff(Shadow Word: Pain, Vampiric Touch etc) where it shows whole seconds until it's 3 seconds left and then it shows milliseconds. So like 5, 4, 2.9, 1.9 and so on.

  2. #2
    I am Murloc! zephid's Avatar
    10+ Year Old Account
    Join Date
    Sep 2010
    Location
    Sweden
    Posts
    5,110
    I'm not really sure if you can do that tbh. The easiest way would just to make 2 auras, one that's visible when there is more than 3 seconds left and one that's visible when there is less than 3 seconds left.

  3. #3
    cant remember where i got it from, but i use this function:

    Code:
    local formatTime = function(s)
    	local day, hour, minute = 86400, 3600, 60
    	if s >= day then
    		return format("%dd", floor(s/day + 0.5)), s % day
    	elseif s >= hour then
    		return format("%dh", floor(s/hour + 0.5)), s % hour
    	elseif s >= minute then
    		return format("%dm", floor(s/minute + 0.5)), s % minute
    	elseif s >= minute / 12 then
    		return floor(s + 0.5), (s * 100 - floor(s * 100))/100
    	end
    	return format("%.1f", s), (s * 100 - floor(s * 100))/100
    end

  4. #4
    Deleted
    Quote Originally Posted by SpaceDuck View Post
    cant remember where i got it from, but i use this function:
    Thanks, the code almost worked in WeakAuras. I modified it a bit to make it work. This is for milliseconds under 5 seconds.

    Code:
    function(expirationTime)
        local s = expirationTime - GetTime()
        local day, hour, minute = 86400, 3600, 60
        if s >= day then
            return format("%dd", floor(s/day + 0.5)), s % day
        elseif s >= hour then
            return format("%dh", floor(s/hour + 0.5)), s % hour
        elseif s >= minute then
            return format("%dm", floor(s/minute + 0.5)), s % minute
        elseif s >= minute / 12 then
            return floor(s + 0.5), (s * 100 - floor(s * 100))/100
        end
        return format("%.1f", s), (s * 100 - floor(s * 100))/100
    end

Posting Permissions

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