As a result of Totemic Restoration, I've been using /script DestroyTotem(2) to remove Earthgrab Totem early to trigger the lower cooldown. However, the slow effect is not applied on the initial tick, only on subsequent ticks (every 2 sec), so I have to time my DestroyTotem manually. I am looking for a script basically does this:

Code:

/cast Earthgrab Totem
/script if time > 2 then DestroyTotem(2)

If possible, the code should stop running if I drop another earth totem. I am willing to add a macro/script to every earth totem if needed.

I also would like if Tremor Totem could be instantly destroyed, or at least in under 0.5 seconds.

3 characters too long (and it creates a new frame/function every time clicked ofc

Well, there's no space in "Earthgrab", so -1 character. Also, "/use" is equvalent to "/cast", so -1 more characters. Since the frame is never reused there's no need to assign it to a variable, so -4 more characters. It could fit, but creating a new frame and a new function every time you cast a totem is pretty horrible, plus making macros for every totem is pretty miserable... I don't think I'd even have enough macro slots left for that.

As noted this while it might work is a bad way to go about it as for every click it will create an anonymous frame and function for the garbage collector.

I think that might be missing the forest for the trees; that macro simply doesn't work. As written, it won't actually destroy any totems. You can probably fix that within the character limit, but you also need to make sure it'll eventually stop destroying totems.

It seems like an easier course of action would be to find an addon that provides /in (maybe this), and then use/cast Earthgrab Totem
/in 2 /run DestroyTotem(2)

Having CreateFrame in a macro to create frames without reusing will cause, in the long run, a lot of frames just staying in the background. Imagine playing active PVP for an hour, you probably spawned a thousand frames that do nothing after the totem has been destroyed. :P

Not to mention that every one of those frames will be running OnUpdate scripts... which just made me notice another problem, which is that the OnUpdate script never terminates, so after 2 seconds, it will try to cancel your earth totem every time a new video frame is drawn, which can be anywhere from 20-100 or more times every second. You'd be unable to use any earth totems for the rest of the session after using one such macro.