Beta Key Giveaway Week 3: Winners have been selected!

  1. #1

    Way to work around the inherent lag of events?

    Essentially the problem is this. There's a delay between the start of the GCD and virtually all other events associated with spells. I suspect it wasn't that big before, as there's a WA patch note that mentions 20ms. Well, it's much bigger now... about 100-140ms, which is easily noticeable by the naked eye (this is with ~33 ms latency and 57 fps). This seems to be exclusive to the GCD, in that you can get information on the GCD as soon as the button is pressed, but everything else is on that delay. A good example is an on-gcd ability with it's own cooldown (I used Maim).

    Code:
    /dump GetSpellCooldown("Maim") 
    /use Maim
    /dump GetSpellCooldown("Maim")
    gives:
    Code:
    [05:48:26] Dump: value=GetSpellCooldown("Maim") 
    [05:48:26] [1]=0, 
    [05:48:26] [2]=0, 
    [05:48:26] [3]=1, 
    [05:48:26] [4]=1 
    [05:48:26] Dump: value=GetSpellCooldown("Maim") 
    [05:48:26] [1]=946024.142, 
    [05:48:26] [2]=1, 
    [05:48:26] [3]=1, 
    [05:48:26] [4]=1
    even though its a 10 second cooldown. (the cdstart value matches GetTime() when run in the macro)

    Is there any way I can get the information on what spell was cast earlier than the UNIT_SPELLCAST_SENT event? There are some actionbar events but those don't actually seem to return any useful information. Even if I could just get which button was pressed might be enough since the addon tracks ability keybinds.

  2. #2
    I'm not sure if I understood exactly what you're trying to do, but you can always hook UseAction and CastSpellByName (I think this is used by /cast). There are also some other functions like CastSpell and CastSpellByID, but I'm not sure when those are called.

    Code:
    hooksecurefunc("UseAction", function(slot, target, button)
    	-- Your code here
    	-- For example:
    	print("UseAction")
    	print(GetActionCooldown(slot))
    end)
    
    hooksecurefunc("CastSpellByName", function(name, target)
    	-- Your code here
    	-- For example:
    	print("CastSpellByName")
    	print(GetSpellCooldown(name))
    end)
    Do note that your function is executed regardless of whether or not the cast is successful.

    Since the live servers are down. I tested this on PTR with 175 ms. The delay between UseAction and UNIT_SPELLCAST_SENT is very noticable.
    Last edited by Kalolt; 2018-01-20 at 03:09 AM.

  3. #3
    That might work, thanks.

Posting Permissions

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