Page 1 of 1

SpellStopCasting() issue. Need help.

PostPosted: Mon Feb 29, 2016 1:18 am
by Jeniwyn
Take this macro

/script SpellStopCasting(); CastSpellByName("Heal");

Press this macro, wait 1.5s for the global cooldown to pass and then press it again and you will abort the heal currently casting and immediately start to cast a new heal. Yay!
(If you are not a priest, any spell with a longer cast time than 1.5 seconds will do)

The only problem is that the client and/or server (I really do not know) cannot keep up and SpellStopCasting() or pressing escape will not work on the newly cast spell at all. It is as if the game has no clue that you are really casting, until the cast finishes and the heal lands. There seems to be no way to abort it other than moving.

My question is this. Is there any way to either:

a) Abort the spell that cannot be aborted via SpellStopCasting() or escape without moving/jumping?
b) Avoid the issue completely, without waiting with the new cast, so that the server/client doesn't miss the cast?

While I realize that the issue might well be unsolvable, I still thought I'd ask here where there are many players far more experienced with wow scripting then I am.

Re: SpellStopCasting() issue. Need help.

PostPosted: Mon Feb 29, 2016 1:38 am
by Youfie
Why did you put the two commands on the same line, rather than two separate ones? Just curiosity, I have no idea how to solve your issue :(.

Re: SpellStopCasting() issue. Need help.

PostPosted: Mon Feb 29, 2016 1:42 am
by Jeniwyn
Youfie wrote:Why did you put the two commands on the same line, rather than two separate ones? Just curiosity, I have no idea how to solve your issue :(.

Just convenience. It doesn't matter if you put them on the same line or not.

Re: SpellStopCasting() issue. Need help.

PostPosted: Mon Feb 29, 2016 2:21 am
by Youfie
Jeniwyn wrote:
Youfie wrote:Why did you put the two commands on the same line, rather than two separate ones? Just curiosity, I have no idea how to solve your issue :(.

Just convenience. It doesn't matter if you put them on the same line or not.

Oh okay, good to know :).

Re: SpellStopCasting() issue. Need help.

PostPosted: Mon Feb 29, 2016 11:49 am
by Geigerkind
I have the solution for that problem lying around somewhere, will post it, when I am back home

Edit:
Okay I couldnt find it on my drive but I found it in my chronics on my browser. I am not sure if that is the working version though. It looks promising though.
Code: Select all
/script if (GLOBAL1 == nil) then GLOBAL1=GetTime()-1 end if GLOBAL1 >= GetTime() then SpellStopCasting(); GLOBAL1=GetTime()-1; else CastSpellByName("Holy Light"); GLOBAL1 = GetTime()+2.5; end

Re: SpellStopCasting() issue. Need help.

PostPosted: Tue Mar 01, 2016 12:03 pm
by Jeniwyn
Thanks for beeing helpful Geiger but I'm afraid that your macro doesn't help with my issue. Or rather, it will help only in the sense that it will cause a delay between the abort and the new cast by requiring two presses of the button.

The idea is to abort and cast a new spell right away. I know that I can wait ~ 0.1-0.2 seconds after aborting, and then this issue will only occur rarely. It does however seem unintuitive to me to on purpose delay a heal that I wanted to cast badly enough to abort another one for it. :)

I guess I'll just have to live with those heals not being abortable. It is just really, really strange that they aren't and it seems that there should be a way to do it.

Re: SpellStopCasting() issue. Need help.

PostPosted: Tue Mar 01, 2016 5:21 pm
by Jeniwyn
I just had an idea. It is kind of ugly and dangerous, I cant wait to try it. The Event API has no problem starting a function while another function is in a pseudo-infinite loop waiting for a variable to change I hope. 8-)

--This in an addon called MyAddon
OnLoad_MyAddon{
--Register All spell events basically

}
OnEvent_MyAddon(){
_DontHealMeBro = false
}

/script _DontHealMeBro=(MyAddonIsLoaded) local t=GetTime()+1; SpellStopCasting(); while _DontHealMeBro and GetTime()<t do end CastSpellByName("Heal")

Will be interesting to see if this will work or freeze my game for a second. :P

There are other variants on this theme with the same basic idea, i.e wait for an event or even better a state that signals that the client is a-ok with the fact that you are allowed to cast. This should on theory make the delay on the cast as small as possible without making it unabortable in case of Lay on Hands/Nature Swiftness.