Surefire way to determine if a spell has landed.

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

NotHere
a lesser mummy
a lesser mummy
Posts: 40
Joined: Fri Jan 09, 2004 5:59 am

Surefire way to determine if a spell has landed.

Post by NotHere » Mon Mar 22, 2004 9:49 am

Hi.

I have been cranking away on a nice little generic kiting macro with INI support, but have hit upon a snag trying to figure out a surefire way to determine if a spell that has begun casting actually lands on the target.

At first I made an event that looked for the message when the spell lands "e.g. Yadayada has been ensnared". The only problem with this approach is that I would like to load the string to look for from an INI file, and since events AFAIK cant be defined during script execution (only during pre-execution), this wouldnt work.

So, I set about doing it "the hard way", that would be, checking for all sorts of events "was resisted", "cannot see your target", "interrupted", etc, etc. However, this approach also has its problems, since there are a "bug" (inconvenience) in the LOS code inside EQ. There are a couple of places where you are almost-but-not-quite in LOS (usually when bouncing with levitation spells), where casting will begin "you begin casting yadayada", but the casting then stops almost immediately (and the spell gem refreshes) with NO message at all that it was interrupted.

So, Im really back to square #1.

Is there someone who can figure out a good way to determine if a spell has actually landed after casting has begun, without hardcoding event texts into the source (thus making it un-generic)?

It has to be efficient too, since the script will sometimes run during high-velocity kiting (unsnared mobs), and the kiter wont survive the script trying to do some extreme parsing.
NotHere
/afk

frabtik
a ghoul
a ghoul
Posts: 114
Joined: Sat Feb 21, 2004 10:07 am

Post by frabtik » Tue Mar 23, 2004 10:07 am

Well I am not sure what you are gonna consider generic and how efficient this is since I don't kite. I also have this problem and have not found a good fix for it yet but am using this solution for now. I use the only event that happens everytime a spell lands. And actually seems to be working very well so far. I use mana pres msg's. The biggest issue with this is when you don't have that gear on. Minor issue that I plan to address soon. The code I use is here in whatever newest greatest spellcast.inc that is out. The positioning of the event allows that it is only checked if the others are not so should not be used unless spell does land and also so it will not fire on a resisted spell which also gives the focus msg. My spellcast.inc is abit customized but I do not think these changes are effected by my personal hacks. And obviously if you only have one mana pres item you don't need two events. If you don't have a mana pres item get one, it has got to be your most important piece of gear. If you find issues with this please post, I have just recently added this update and so far it seems to work very well, although there is a lot of spam from my other focus's that are firing off before casting, like spell haste.

If you are unfamiliar with these references check the spellcast.inc out in snippets to see how it works and where the lines go. I added the ClearReturnValue before I start the /doevents section.

Code: Select all

/call ClearReturnValue

Code: Select all

#event SpellLanded "Your Sharp Claw Ahlspiess flickers with a pale light."
#event SpellLanded "Your Rosrak's Boots of the Primal flickers with a pale light."

Code: Select all

   /if "$return"=="FD_FAILED" /return "$return" 
   /doevents SpellLanded
   /if "$return"=="NULL" /goto :StartCast 
/return CAST_SUCCESS 

Code: Select all

Sub Event_SpellLanded
|Basically lets you know for sure your spell hit the mob, no LoS without msg or too
|far out to get msg it hit.  Called before after check so should mean success.
/return CAST_SUCCESS

Falco72
a hill giant
a hill giant
Posts: 215
Joined: Fri Sep 26, 2003 3:24 am

Post by Falco72 » Tue Mar 23, 2004 10:29 am

How do work around resists, frabtik? You will have a Spelllanded event even when your spell is resisted. Do you use an event like this maybe?

Code: Select all

#Event CastResist "Your target resisted "

NotHere
a lesser mummy
a lesser mummy
Posts: 40
Joined: Fri Jan 09, 2004 5:59 am

Post by NotHere » Tue Mar 23, 2004 1:10 pm

Thanks alot, both of you

That was exactly the kind of workaround I needed. :D

It does take a bit of the genrity (if such a word exists) out of the macro, but users would only be required to enter events for the couple of mana pres foci they may be carrying, instead of having to modify the script every time they wanted to use different spells.

Gonna combine it with a resist check, and all should be fine and dandy.

Again, many thanks!
NotHere
/afk

recker
decaying skeleton
decaying skeleton
Posts: 4
Joined: Mon Mar 22, 2004 3:41 pm
Location: socal

cool

Post by recker » Tue Mar 23, 2004 1:49 pm

landing spells for sure is awsome, but could someone post some more code and explain a lil more im still lost on how that works even with all that. would love the help thanks

frabtik
a ghoul
a ghoul
Posts: 114
Joined: Sat Feb 21, 2004 10:07 am

Post by frabtik » Wed Mar 24, 2004 10:43 am

The code I showed is snippets that I have added to the spellcast.inc that is posted in the snippets forum. The only part that would be hard to understand I showed the lines above it so you could see where it would go. The resist check is up furthur in the list of events checked. I think if you examine or already use this code adding what I posted is trivial. I didn't post my whole file because I have lots of odd comments and stuff I have either commented out or am testing etc to make the inc fit my needs better and I didn't want this extra stuff confusing anyone etc. since some is experimental and may not be tested, working, etc.

drax
orc pawn
orc pawn
Posts: 12
Joined: Wed Oct 15, 2003 12:02 am

Post by drax » Thu Mar 25, 2004 11:34 am

why do you have to add a line for each preservation item you have?

dont they all follow the same format?

Code: Select all

Your Sharp Claw Ahlspiess flickers with a pale light.
and if so, you just need 1 event to catch them all.

Code: Select all

#event SpellLanded "flickers with a pale light."

User avatar
Bad Karma
a snow griffon
a snow griffon
Posts: 346
Joined: Sat Nov 22, 2003 9:34 pm
Contact:

Re: cool

Post by Bad Karma » Thu Mar 25, 2004 9:23 pm

recker wrote:landing spells for sure is awsome, but could someone post some more code and explain a lil more im still lost on how that works even with all that. would love the help thanks
http://macroquest2.com/phpBB2/viewtopic.php?t=5373
[b]- Bad Karma
________________________________________[/b]

In our own quest for excellence, we should strive to take the time to help those who help themselves.

All others should [b]RTFM[/b]!!!!!!!!!

Gumby
a ghoul
a ghoul
Posts: 99
Joined: Sat Jan 24, 2004 5:27 pm

Post by Gumby » Fri Mar 26, 2004 11:32 am

drax wrote:why do you have to add a line for each preservation item you have?

dont they all follow the same format?

Code: Select all

Your Sharp Claw Ahlspiess flickers with a pale light.
and if so, you just need 1 event to catch them all.

Code: Select all

#event SpellLanded "flickers with a pale light."
Actually his first issue (z-axis problems producing instantly ended casts) is really an issue with using focus effect messages to determine successful cast ;)

They trigger under those circumstances.

G

NotHere
a lesser mummy
a lesser mummy
Posts: 40
Joined: Fri Jan 09, 2004 5:59 am

Post by NotHere » Fri Mar 26, 2004 12:15 pm

Gumby wrote:
drax wrote:

Code: Select all

#event SpellLanded "flickers with a pale light."
Actually his first issue (z-axis problems producing instantly ended casts) is really an issue with using focus effect messages to determine successful cast ;)

They trigger under those circumstances.
Ah, not really.

Mana Pres foci trigger after spell casting has completed. So, actually, they seem to be a surefire way to determine if casting your last spell was completed.

And '... flickers with a pale light' are AFAIK only used by Mana Pres foci as well, so just matching that would be easy.
NotHere
/afk