Reply
Thread Tools Display Modes
Unread 09-12-12, 07:13 PM   #1
Splondir
A Murloc Raider
 
Splondir's Avatar
Join Date: Dec 2007
Posts: 4
Totem Destroying Script

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.
Splondir is offline   Reply With Quote
Unread 09-12-12, 07:54 PM   #2
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,191
Not possible.

Addons/scripts are not allowed to make combat decisions (and by not allowed I mean Blizzard has removed the functionality)
Dridzt is offline   Reply With Quote
Unread 09-12-12, 11:19 PM   #3
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,267
It is possible; DestroyTotem is not a protected function. It does not require a hardware event, and can be called at any time by an addon or macro, including in combat.

However, there is not enough space in a macro to run a timer. I will probably write an addon later, since it seems useful.

Edit: And done.
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!

Last edited by Phanx : 09-13-12 at 05:51 AM.
Phanx is offline   Reply With Quote
Unread 09-13-12, 12:03 AM   #4
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,191
Oh, my bad, my mind went directly to the old totemstomper macros (for destroying enemy totems in pvp)

Didn't realize this was referring to own totems, I'll learn to pay more attention next time

On the other hand *arrgh*
Code:
/use EarthGrab Totem
/run local t=0;CreateFrame("Frame"):SetScript("OnUpdate",function(_,e)t=t+e>2 and DestroyTotem(2)end)
9 characters to spare (but it creates a new frame/function every time clicked ofc )

Last edited by Dridzt : 09-13-12 at 06:15 AM. Reason: sneaky
Dridzt is offline   Reply With Quote
Unread 09-13-12, 05:50 AM   #5
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,267
Okay, it's an addon now:
http://www.wowinterface.com/downloads/info21610
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Unread 09-13-12, 05:56 AM   #6
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,267
Originally Posted by Dridzt View Post
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.
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Unread 09-13-12, 12:54 PM   #7
Macro-Wow
A Deviate Faerie Dragon
Join Date: Sep 2012
Posts: 18
Originally Posted by Dridzt View Post
Oh, my bad, my mind went directly to the old totemstomper macros (for destroying enemy totems in pvp)

Didn't realize this was referring to own totems, I'll learn to pay more attention next time

On the other hand *arrgh*
Code:
/use EarthGrab Totem
/run local t=0;CreateFrame("Frame"):SetScript("OnUpdate",function(_,e)t=t+e>2 and DestroyTotem(2)end)
9 characters to spare (but it creates a new frame/function every time clicked ofc )
Nice macro, mind if I submit it to my site with you as the author?
__________________
My Wow macros website:
Macro-Wow.com - handpicked Wow macros
Share your macros!

Interests include web dev, design and gaming
Macro-Wow is offline   Reply With Quote
Unread 09-13-12, 01:24 PM   #8
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,051
I wouldn't advise anyone use that macro since it creates a new Frame object (which is immune to the Lua garbage collector) every time it's used.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of Revelation, Spamalyzer, TravelAgent, Volumizer, and many other AddOns.
Torhal is offline   Reply With Quote
Unread 09-13-12, 01:26 PM   #9
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,191
Originally Posted by Macro-Wow View Post
Nice macro, mind if I submit it to my site with you as the author?
I'd rather you didn't
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.

Or... if you insist, don't attach my name to it

Edit: Damn you Torhal, stop posting on top of me
Dridzt is offline   Reply With Quote
Unread 09-13-12, 05:54 PM   #10
Foxlit
A Warpwood Thunder Caller
 
Foxlit's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 91
Originally Posted by Dridzt View Post
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)
__________________
... and you do get used to it, after a while.

Last edited by Foxlit : 09-13-12 at 06:04 PM.
Foxlit is offline   Reply With Quote
Unread 09-13-12, 06:03 PM   #11
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,191
Originally Posted by Foxlit View Post
I think that might be missing the forest for the trees; your macro doesn't work at all.

It seems like an easier course of action would be to find an addon that provides /in (maybe this), and simply use
/cast Earthgrab Totem
/in 2 /run DestroyTotem(2)
There's already an addon come out of this very thread.

Additionally my macro was drycoded and more a tongue in cheek comment than anything.
I can make it work with a couple parentheses is that the point?
Dridzt is offline   Reply With Quote
Unread 09-14-12, 06:41 AM   #12
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 761
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
__________________
Profile: Curse | Wowhead
Vlad is offline   Reply With Quote
Unread 09-14-12, 03:54 PM   #13
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,267
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.
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Unread 09-14-12, 11:32 PM   #14
Macro-Wow
A Deviate Faerie Dragon
Join Date: Sep 2012
Posts: 18
__________________
My Wow macros website:
Macro-Wow.com - handpicked Wow macros
Share your macros!

Interests include web dev, design and gaming
Macro-Wow is offline   Reply With Quote
Unread 09-15-12, 03:48 AM   #15
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,267
Divided by zero? No, that guy just dropped his Nokia!
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Reply

Go BackWoWInterface » AddOns, Compilations, Macros » Macro Help » Totem Destroying Script

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off