Need help with a macro you are writing? Ask here!
Moderator: MacroQuest Developers
-
BobWeaver
- a lesser mummy

- Posts: 60
- Joined: Thu Jul 19, 2007 7:47 pm
Post
by BobWeaver » Fri Jul 20, 2007 12:47 am
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.
Last edited by
BobWeaver on Fri Jul 20, 2007 8:43 am, edited 1 time in total.
-
jacensolo
- a snow griffon

- Posts: 427
- Joined: Wed Feb 14, 2007 8:51 am
- Location: Right behind you
Post
by jacensolo » Fri Jul 20, 2007 1:54 am
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.
-
BobWeaver
- a lesser mummy

- Posts: 60
- Joined: Thu Jul 19, 2007 7:47 pm
Post
by BobWeaver » Fri Jul 20, 2007 8:42 am
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.
-
fearless
- Not a Psychic
- Posts: 2684
- Joined: Wed Mar 10, 2004 3:52 pm
Post
by fearless » Fri Jul 20, 2007 10:23 am
This does not work.
Reading . . . it's not just for me.
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]
-
BobWeaver
- a lesser mummy

- Posts: 60
- Joined: Thu Jul 19, 2007 7:47 pm
Post
by BobWeaver » Fri Jul 20, 2007 11:04 am
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!
-
fearless
- Not a Psychic
- Posts: 2684
- Joined: Wed Mar 10, 2004 3:52 pm
Post
by fearless » Fri Jul 20, 2007 11:26 am
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.
Reading . . . it's not just for me.
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]
-
jacensolo
- a snow griffon

- Posts: 427
- Joined: Wed Feb 14, 2007 8:51 am
- Location: Right behind you
Post
by jacensolo » Fri Jul 20, 2007 11:32 am
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.
-
BobWeaver
- a lesser mummy

- Posts: 60
- Joined: Thu Jul 19, 2007 7:47 pm
Post
by BobWeaver » Fri Jul 20, 2007 11:42 am
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!
-
fearless
- Not a Psychic
- Posts: 2684
- Joined: Wed Mar 10, 2004 3:52 pm
Post
by fearless » Fri Jul 20, 2007 12:30 pm
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!
Reading . . . it's not just for me.
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]
-
BobWeaver
- a lesser mummy

- Posts: 60
- Joined: Thu Jul 19, 2007 7:47 pm
Post
by BobWeaver » Fri Jul 20, 2007 1:20 pm
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!
-
jacensolo
- a snow griffon

- Posts: 427
- Joined: Wed Feb 14, 2007 8:51 am
- Location: Right behind you
Post
by jacensolo » Fri Jul 20, 2007 2:17 pm
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.
-
BobWeaver
- a lesser mummy

- Posts: 60
- Joined: Thu Jul 19, 2007 7:47 pm
Post
by BobWeaver » Fri Jul 20, 2007 2:35 pm
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.
-
BobWeaver
- a lesser mummy

- Posts: 60
- Joined: Thu Jul 19, 2007 7:47 pm
Post
by BobWeaver » Sat Jul 21, 2007 1:37 pm
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.
-
fearless
- Not a Psychic
- Posts: 2684
- Joined: Wed Mar 10, 2004 3:52 pm
Post
by fearless » Sat Jul 21, 2007 1:41 pm
if is a calculator.
Reading . . . it's not just for me.
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]
-
BobWeaver
- a lesser mummy

- Posts: 60
- Joined: Thu Jul 19, 2007 7:47 pm
Post
by BobWeaver » Sun Jul 22, 2007 12:48 pm
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.