Help with spell recasting

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

Moderator: MacroQuest Developers

Lane
a hill giant
a hill giant
Posts: 201
Joined: Fri Dec 06, 2002 11:57 am

Help with spell recasting

Post by Lane » Wed Sep 01, 2004 6:06 pm

Hey everyone. In the macro below once Blood of Thule wears off it keeps trying to cast it on the mob. Not sure what could be wrong and thought I had looked at everything. Maybe a new set of eyes will help.

What happens:
1. Cast snare, funeral pyre, Blood of Thule
2. Start macroing the kite, pet gets sent, saryrn's kiss gets cast
3. Blood of thule wears off, and at next stop start to cast again
4. Every time I stop, blood gets cast.

Saryn's kiss works just fine.

Any help would be appriciated.

-Lane

Code: Select all


| Necrokite2.mac
| Originally By: Terramantian however highly modified by Lane
|
| Kiting macro for a 65 necromancer in a specific zone.
| Pull mob with Darkness, FP, and BT already applied, start macro


#turbo
#include spell_routines.inc
#include move.inc

#event Hit "#*#YOU for#*#"
#event exp "#*#experience!#*#"
#event blood "#*#Blood of Thule#*#"

Sub Main
   /declare PetAttacking bool outer
   /declare Sarynson bool outer
   /declare Bloodofon bool outer
   /declare startexp outer 0
   /declare startaaxp outer 0
   /declare currentxp outer 0
   /declare xpgain outer 0
   /declare currentaa outer 0
   /declare aagain outer 0

   /varset PetAttacking 0
   /varset Sarynson 0
   /varset Bloodofon 1
   /varset startexp ${Me.PctExp}
   /varset startaaxp ${Me.PctAAExp}

:Loop

   /delay 2s (${Target.Distance} <= 120)
      /call MoveToLoc -363 947

/doevents
/call checkpet
/call checkdots

   /delay 5s (${Target.Distance} <= 120)
	/call MoveToLoc -520 948

/doevents
/call checkpet
/call checkdots

   /delay 5s (${Target.Distance} <= 120)
	/call MoveToLoc -440 763

/doevents
/call checkpet
/call checkdots

   /delay 5s (${Target.Distance} <= 120)
	/call MoveToLoc -242 805

/doevents
/call checkpet
/call checkdots

/goto :Loop

Sub safe
 	/call MoveToLoc -363 947
/return

Sub checkpet
   /if ((!${PetAttacking}) && (${Target.PctHPs} < 90)) {
      /pet attack
      /varset PetAttacking 1
	}
/return

Sub checkdots
/if ((!${Sarynson}) && (${Target.Distance} >= 165)) {
		/delay 1s
		/call cast "Saryrn's Kiss" 2	
		/delay 1s	
		/varset Sarynson 1
	}


/if ((!${Bloodofon}) && (${Target.Distance} >= 165)) {
		/delay 1s
		/call cast "Blood of Thule" 5	
		/delay 1s	
		/varset Bloodofon 1
	}
/return

Sub Event_exp
   /varset currentxp ${Me.PctExp}
   /varset xpgain ${Math.Calc[${currentxp}-${startexp}]}
   /varset currentaa ${Me.PctAAExp}
   /varset aagain ${Math.Calc[${currentaa}-${startaaxp}]}
      /popup "Gain: ${xpgain}% xp - ${aagain}% aa ## Cur: ${Me.PctExp}% xp - ${Me.PctAAExp}% aa"
      /echo "Gain: ${xpgain}% xp - ${aagain}% aa ## Cur: ${Me.PctExp}% xp - ${Me.PctAAExp}% aa"
   /varset startexp ${Me.PctExp}
   /varset startaaxp ${Me.PctAAExp}

  /end
/return

Sub Event_blood
	/varset Bloodofon 0
/return

I Macroquest, therefor I am!

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Wed Sep 01, 2004 6:54 pm

Code: Select all

Sub Event_blood 
   /varset Bloodofon 0 
/return 
I notice that there isn't such a sub for Saryn, which you say works properly. They both have the exact same format of /if statements, so the only difference is that, the event. Try taking it out and see what happens.
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!

Lane
a hill giant
a hill giant
Posts: 201
Joined: Fri Dec 06, 2002 11:57 am

Post by Lane » Wed Sep 01, 2004 7:02 pm

Actually, Blood is cast before the macro start. So I set the variable at 1 when I start, then I need this event to see when it drops because I want to cast it again. Saryrn's almost never runs out before the mob is dead so I never bother to set it back to 0 so that I will cast it again.
They both have the exact same format of /if statements,
Which is what's really pissing me off that it doesn't work right. :)

-Lane
I Macroquest, therefor I am!

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Wed Sep 01, 2004 7:10 pm

Ok then I think there is a miscommunication here.
Lane wrote:In the macro below once Blood of Thule wears off it keeps trying to cast it on the mob.
Which I take to mean you don't want it casting it again.

Now it sounds like you are having an issue with it casting non stop.
Perhaps after the Bloodof event you should /doevents flush? I'm not totally sure how that works, but from my understanding it should do exactly that, flush your event buffer clear of everything. Problem is that this could cause you to miss something, but what is the likelyhood of that?
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!

Lane
a hill giant
a hill giant
Posts: 201
Joined: Fri Dec 06, 2002 11:57 am

Post by Lane » Wed Sep 01, 2004 7:46 pm

/doevents flush
Wow, simple command makes things work much better.... Thanks aC1.

-Lane
I Macroquest, therefor I am!

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Wed Sep 01, 2004 7:51 pm

Have you tried it and found it to work then?
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Thu Sep 02, 2004 6:57 am

You're matching your blood event after the string "blood of thule" which would not only be triggered by the text you see when it wears off but also from for example "You begin casting Blood of Thule" and "MobX has taken 100 damage from your Blood of Thule". Make the event "Your Blood of Thule spell has worn off." or whatever the message is instead.

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Thu Sep 02, 2004 7:56 am

"#*#Blood of#*#worn off#*#"
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!

User avatar
Cr4zyb4rd
Plugins Czar
Posts: 1449
Joined: Tue Jul 20, 2004 11:46 am

Post by Cr4zyb4rd » Thu Sep 02, 2004 8:17 am

Um, aC1, what's so terrible about doing the (much faster...not that it matters in a macro) exact string match?

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Thu Sep 02, 2004 8:39 am

Because I don't have it in front of me? But yeah, exact would be better.

I think it would be "#*#Your Blood of Thule spell has worn off."
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!

Lane
a hill giant
a hill giant
Posts: 201
Joined: Fri Dec 06, 2002 11:57 am

Post by Lane » Thu Sep 02, 2004 6:56 pm

Yes. Flushing the events worked. I made the mistake of thinking that they would get dumped once I did a /doevents.

Doing it on exact match would be better, I agree, and now I'm wondering why it doesn't keep casting because it's not. Oh, I know why. I call the cast, then flush the events (in the macro I have on my puter), so I flush whatever event happens while I'm casting (i.e. You begin casting blood of thule. Otherwise I would be casting over and over. That's probably not the best option either as I could lose other events later on if this macro grows.

Thanks for all the good ideas.

-Lane
I Macroquest, therefor I am!