#event?

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

drodaan
decaying skeleton
decaying skeleton
Posts: 5
Joined: Tue Jan 04, 2011 11:43 pm

#event?

Post by drodaan » Mon Jan 31, 2011 12:59 pm

i'm completely new, trying to write a macro that will watch for a spell wearing off, and recast it when it does. honestly i don't even know if this is possible, but it looks like it can be done with #event, though i can't make heads or tails of how it would be done. i've read the event and subroutine sections of the manual, but the examples given there looked far more complicated than what i need. can someone point me in the right direction?

xomega1
a ghoul
a ghoul
Posts: 134
Joined: Mon Jun 19, 2006 6:02 pm

Re: #event?

Post by xomega1 » Mon Jan 31, 2011 1:11 pm

Code: Select all

#event recast "wear off message from your spell#*#"

Sub Main

:loop
/doevents
/goto :loop
/return

Sub Event_recast
  cast your spell here
/return

drodaan
decaying skeleton
decaying skeleton
Posts: 5
Joined: Tue Jan 04, 2011 11:43 pm

Re: #event?

Post by drodaan » Mon Jan 31, 2011 1:31 pm

wow thanks, that helped a lot more than the manual. worked like a charm and now i have something to build on.

drodaan
decaying skeleton
decaying skeleton
Posts: 5
Joined: Tue Jan 04, 2011 11:43 pm

Re: #event?

Post by drodaan » Mon Jan 31, 2011 1:32 pm

one question though, what is the "#*#" for?

Maskoi

Re: #event?

Post by Maskoi » Mon Jan 31, 2011 2:05 pm

drodaan wrote:one question though, what is the "#*#" for?
#*# is a wild card/catch all that ignores all the text up to the point you have it in the event statement.

Say you wanted to create an event that just looked for the word Fred.

Your levitation spell wore off Fred.

Code: Select all

#event "#*#Fred#*#"
The first #*# would ignore everything up to including the space Fred i.e. "Your levitation spell wore off "

The second #*# would ignore everything after Fred i.e. "." the period

It recognizes spaces also so "#*#Fred #*#" would fail because of the space before the second #*#.
Its looking for Fred with a space and the actual text is Fred. with a period.

Typical use

Code: Select all

#Event  ImDead          "You have been slain by#*#"
the event would fire on any of the following messages
You have been slain by an orc
You have been slain by a griffon
You have been slain by a rabbit
because the event ignores everything after by

drodaan
decaying skeleton
decaying skeleton
Posts: 5
Joined: Tue Jan 04, 2011 11:43 pm

Re: #event?

Post by drodaan » Mon Jan 31, 2011 2:40 pm

i broke my macro already. i tried to incorporate a canni feature. it works but doesn't recast anymore.
edit: fixed it with trial and error. however it will fail from a fizzle. let me guess... i need another #event?

Code: Select all

#event recast "Your _____ spell has worn off of _____.#*#"

Sub Main

/cast 2


:hot
/doevents
/if (${Me.Casting.ID})    /goto :hot
/if (${Me.PctMana}<80)    /goto :canni
/goto :hot
/return

:canni
/if (!${Me.SpellReady[spellnamehere]})  /goto :hot
/cast 6
/goto :hot


Sub Event_recast
  /cast 2
/return

thanks again for the support

xomega1
a ghoul
a ghoul
Posts: 134
Joined: Mon Jun 19, 2006 6:02 pm

Re: #event?

Post by xomega1 » Mon Jan 31, 2011 4:04 pm

Yup you would need another event to handle a fizzle.

Maskoi

Re: #event?

Post by Maskoi » Mon Jan 31, 2011 4:36 pm

xomega1 wrote:Yup you would need another event to handle a fizzle.
To compensate for a fizzle try coding it like you would a hot key but use /delay instead of pause. See if that works

/cast 2
/delay 5
/cast 2