1. #1
    Deleted

    LUA - Get time left before spell is off cooldown

    What is the simplest way to get the time left before spell is off cooldown ?

    I'm trying to track Vampiric Blood (blood dk spell).

    Can't really find the proper way to do it with GetSpellCooldown. Duration is not helping much.
    Code:
    local s, d, e = GetSpellCooldown("Vampiric Blood")

  2. #2
    The Lightbringer
    15+ Year Old Account
    Join Date
    Jun 2008
    Location
    Italy
    Posts
    3,564
    s+d-GetTime() will return the time left

  3. #3
    start + duration is equal to expiration time, so just

    e - GetTime()

    it helps to think of these things as large numbers rather than temporally. Expiration time is a time in the future, so its a time number that is bigger than the current time number. Simply subtract the current time number from it and this equation will process towards 0 when the spell comes off cooldown.

  4. #4
    The Lightbringer
    15+ Year Old Account
    Join Date
    Jun 2008
    Location
    Italy
    Posts
    3,564
    e isn't expiration time, but enable. returns 0 if the cooldown starts when the effect finished (i.e. Stealth) or 1 otherwise

  5. #5
    Quote Originally Posted by S7orm View Post
    e isn't expiration time, but enable. returns 0 if the cooldown starts when the effect finished (i.e. Stealth) or 1 otherwise
    Oh yeah derp I'm off the ball today. On a related note I was going to mention to the OP that you really should name your variables something that is more clear than just a single letter. The processing savings of a shorter variable name are negligible and when you start making more complex functions you might end up bamboozling yourself in a similar way to how I just did

  6. #6
    If you just wanting to track the cooldown, Why are you not just using Cooldown Progress (Spell) that is built into WeakAura's?

  7. #7
    High Overlord Ironi's Avatar
    15+ Year Old Account
    Join Date
    Dec 2007
    Location
    Finland
    Posts
    114
    You are aware that there are other addons than WA right?
    +just becouse you want to know a cooldown of something doesn't mean you want to see it in your screen
    Abandon the search for Truth; settle for a good fantasy.
    iKeystones, iLFRDescription, iEncounterEventTracker

Posting Permissions

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