Page 1 of 1

Detect Spells cast by Group Members?

Posted: Fri Jul 20, 2007 12:47 am
by BobWeaver
I'm trying to write some code into a macro that will detect if a group member is casting a spell. I tried the following (just to display a value):

Code: Select all

/echo ${Group.Member[${Loops}].Casting.ID}
But it comes up null for all group members except myself. I figured this was because I did not have the Leadership Ability "Spell Awareness" so I saved up and bought it. The ID still comes up null, even if I manually replace ${Loops} with a group member that is casting.
Thanks in advance for any help!

Edited WIKI - http://www.macroquest2.com/wiki/index.p ... wn#Members.

Posted: Fri Jul 20, 2007 1:54 am
by jacensolo
I'm assuming that that in your post you just forgot to add the ending "}", but if it's like that in your code, it would mess up. Another thing to check is I think you need 3 or more in group for leader stuff to kick in.

Posted: Fri Jul 20, 2007 8:42 am
by BobWeaver
Yeah, I forgot the ending "}" here. I'll make the edit. There are three people in the group. I really feel like it should work, but I can't see why it is not.

Posted: Fri Jul 20, 2007 10:23 am
by fearless
This does not work.

Posted: Fri Jul 20, 2007 11:04 am
by BobWeaver
Yeah, that's what I experienced. Is it supposed to work? Is there a way to find out if/what a group member is casting?
Thanks for the help!

Posted: Fri Jul 20, 2007 11:26 am
by fearless
BobWeaver wrote:Is it supposed to work?
no
BobWeaver wrote:Is there a way to find out if/what a group member is casting?
sure, have the bot put its casting.id into shared channels and have other bots use events.

Posted: Fri Jul 20, 2007 11:32 am
by jacensolo
If he has the group leader spell awareness AA, couldn't he just use an event to detect however it tells him naturally? Its been a while since I've played with someone who had the ability, but doesnt it add <SpellName> after "begins to cast a spell" bit? So wouldnt this work:

Code: Select all

#event GroupCast "#1# begins to cast a spell. <#2#>"
After fixing any errors between that and the actual line it gives you, that should catch the caster and spell without any special channels.

Posted: Fri Jul 20, 2007 11:42 am
by BobWeaver
If he has the group leader spell awareness AA, couldn't he just use an event to detect however it tells him naturally? Its been a while since I've played with someone who had the ability, but doesnt it add <SpellName> after "begins to cast a spell" bit? So wouldnt this work:

Code: Select all

#event GroupCast "#1# begins to cast a spell. <#2#>" 
After fixing any errors between that and the actual line it gives you, that should catch the caster and spell without any special channels.
I like that a lot. Then I don't have to be running a macro on the other machines - just the one watching for spells.
Thanks for your help!

Posted: Fri Jul 20, 2007 12:30 pm
by fearless
jacensolo-

Yes, you can use events. I'm not terribly familiar with Spell Awareness, I thought it was just for NPC's.

Sorry about that!

Posted: Fri Jul 20, 2007 1:20 pm
by BobWeaver
jacensolo,
I used your idea - thanks. Here is the subroutine code if anyone is interested:

Code: Select all

|============================|
|Group Cast code:
|---------------------------------------------------
Sub Event_GroupCast(SpellMessage, SpellCaster, SpellName)

  /for Loops 1 to ${Group.Members}
    /if (${Group.Member[${Loops}].Name.Equal[${SpellCaster}]}) {
      /varcalc intFreeToMoveTime ${Macro.RunTime} + 25
      /echo ${SpellCaster} is casting ${SpellName}.
    }
  /next Loops
	
/Return
Then I just use intFreeToMoveTime later in my code. I just wait 25 seconds for any spell, which I know is overkill but it's what "Hand of Tenacity" needs and It's not worth my time to write specific delays for each spell. :)

Thanks!

Posted: Fri Jul 20, 2007 2:17 pm
by jacensolo
Have you tried using something like this:

Code: Select all

/varcalc intFreeToMoveTime ${Macro.RunTime} + ${Spell[${SpellName}].CastTime}
Might have to add like a +5 or something to that to account for lag issues, but that would give you fairly accurate (I don't think it calculates cast time reducing focus effects) time for any spell.

Posted: Fri Jul 20, 2007 2:35 pm
by BobWeaver
I did not even think of that. It works even better now. Thanks for a very solid answer without condescending tone. ;)
You are very helpful, I really appreciate it.

Posted: Sat Jul 21, 2007 1:37 pm
by BobWeaver
I put that line of code inside another /if statement to prevent a short cast from overwriting a long cast:

Code: Select all

/if (${Macro.RunTime} + ${Spell[${SpellName}].CastTime} > ${intFreeToMoveTime}) {
Thought I'd have to use MathCalc, but it seems to work great now.
Thanks again.

Posted: Sat Jul 21, 2007 1:41 pm
by fearless
if is a calculator.

Posted: Sun Jul 22, 2007 12:48 pm
by BobWeaver
Yep, it performs Math.Calculate for you automatically. Then it basically gives you a boolean response based on your criteria so you can perform commands based on that result. Probably the most important command we have!
Thanks for the help, guys.