spell_routines.inc ( updated: 11/07/2004 )

A forum for macro code snippets to be used in writing other macros. Post routines or .inc files here only, completed macros go to the Macro Depot. MQ2Data format only!

Moderator: MacroQuest Developers

Chill
Contributing Member
Contributing Member
Posts: 435
Joined: Fri May 07, 2004 5:06 pm
Location: Erie, PA

Re: Chain Casting?

Post by Chill » Wed Oct 27, 2004 11:54 am

Furiousness wrote:Could someone post me a quick idea on how to chain cast?

I have a loop that runs two nukes, basically I want to cast the next as soon as the previous has finished, rinse repeat....
This probably isnt the right place for that question, but since you asked here I will answer it here.
Furiousness wrote:ie if !me.casting.id && me.spellready[nuke] /cast nuke
Dont worry about ${Me.Casting} use ${Me.SpellReady["SPELL NAME"]}. And if you're going to include Spell_Routines.inc (which I suggest you do) make sure you /call cast "SPELL NAME" all your spells.

I have a macro my chanter uses that chain nukes for me using two nukes I alternate (along with tashing, slowing, buffing, and some other stuff). I updated it recently and dont have my newest code on this machine, but here is what I think I am using:

Code: Select all

#Include SpellCast.inc 
...
/declare MobID int outer
/declare MinHP int outer 5
/declare Nuke1Mana int outer 2000
/declare Nuke2Mana int outer 3000
...
/varset MobID ${Target.ID}
...
/if (${Target.PctHPs}>${MinHP}) /call Nuke
...

Sub Nuke
  :nuke
  /if (${Target.ID}!=${MobID}) /return
  /call Boggle
  /if (${Me.PctMana} < 95 && ${Target.PctHPs}>=${MinHP}) /call ManaTap
  /if (${Me.SpellReady["Ancient: Chaos Madness"]} && ${Target.PctHPs}>=${MinHP} && ${Me.CurrentMana}>=${Nuke1Mana} && ${Target.ID}==${MobID}) { 
    /call cast "Ancient: Chaos Madness"
  } else {
    /if (${Me.SpellReady["Madness of Ikkibi"]} && ${Target.PctHPs}>=${MinHP} && ${Me.CurrentMana}>=${Nuke2Mana} && ${Target.ID}==${MobID}) /call cast "Madness of Ikkibi"
  }
  /doevents damage

  /if (${Target.PctHPs} >= ${MinHP}) /goto :nuke
/return

Sub Boggle
  /delay 1
  /if (${Me.TargetOfTarget.ID} == ${Me.ID}) { 
    /call cast "Boggle" 
    /return AGRO 
  } 
/return NOAGRO 
I will try to edit this after work and paste exactly what I have from my macro since I know for sure it works, but I hope that helps you get started.

If you want to post what you come up with to the Macro Help or Macro Depot forum, I will try to help you get it doing what you want. If you tell me what class you are, what spells you want to use, and what else you might want to do while nuking (or I can see it in your macro), I can try to help you get your macro working.
Last edited by Chill on Wed Oct 27, 2004 6:34 pm, edited 1 time in total.

Chill
Contributing Member
Contributing Member
Posts: 435
Joined: Fri May 07, 2004 5:06 pm
Location: Erie, PA

Re: Chain Casting?

Post by Chill » Wed Oct 27, 2004 12:05 pm

A_Druid_00 wrote:Maybe just try:

Code: Select all

/if ${me.spellready[WTFeveryourspellis]} /cast WTFeveryourspellis
Case and quotes matter. Your example should be:

Code: Select all

/if (${Me.SpellReady["WTFeveryourspellis"]}) /call cast "WTFeveryourspellis"
See above for solid examples.

User avatar
fearless
Not a Psychic
Posts: 2684
Joined: Wed Mar 10, 2004 3:52 pm

Post by fearless » Wed Oct 27, 2004 12:19 pm

And that is a mighty fine example Chill ;)
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]

Rusty~
a hill giant
a hill giant
Posts: 244
Joined: Wed Apr 14, 2004 2:55 pm

Post by Rusty~ » Wed Oct 27, 2004 3:52 pm

ok added in an outer variable to show if your last spell didn't take hold. /if ${spellNotHold} is 1, then your last spell didn't take hold, otherwise it's 0

Furiousness
a lesser mummy
a lesser mummy
Posts: 62
Joined: Tue Aug 26, 2003 3:48 pm

Post by Furiousness » Wed Oct 27, 2004 7:04 pm

Aewsome, thank you, slaps head for not reading the instructions....../call cast "Spellname"


Doh!!! That would be it as the native /cast one wont check that all is ready!!!


Thank you very much Chill.

RDPidb
a lesser mummy
a lesser mummy
Posts: 69
Joined: Mon Dec 15, 2003 1:14 am

Post by RDPidb » Tue Nov 02, 2004 6:29 am

No support for feighn death ??!!!!!
Add an event for "has fallen to the ground" and make it return FDFAILED or something. oh standing back up after it fails woudl be good in the .inc ... cant think of any reason you would not want to stand after a failed FD.

Code: Select all

CAST_FD_FAILED    | You fall to the ground - fd was not succesfull

#event FDFailed "#*#has fallen to the ground#*#" 

/doevent FDFailed

Sub Event_FDFailed
   /if ( ${Defined[castReturn]} ) /varset castReturn CAST_FD_FAILED
/return 

or maybe this

Code: Select all

Sub Event_FDFailed
   /if ( ${Defined[castReturn]} ) /varset castReturn CAST_FD_FAILED
   /if (!${Me.Standing}) /stand
/return 

thx

Alisandra
orc pawn
orc pawn
Posts: 28
Joined: Fri Aug 30, 2002 9:55 pm

Post by Alisandra » Tue Nov 02, 2004 7:27 am

The problem with that is it triggers when someone *else* fails FD near you. This works for me:

Code: Select all

#event FDFail "#1# has fallen to the ground.#*#"

Code: Select all

Sub Event_FDFail(EventLine,TargetName)
   /if ( ${TargetName.Equal[${Me.Name}]} && ${Defined[castReturn]} ) /varset castReturn CAST_RESTART
/return

RDPidb
a lesser mummy
a lesser mummy
Posts: 69
Joined: Mon Dec 15, 2003 1:14 am

Post by RDPidb » Tue Nov 02, 2004 8:26 am

ah, very good point.
Thanks for the info.

Could you do :

Code: Select all

#event FDFail "#1# ${Me.Name} has fallen to the ground.#*#" 
??

Also I notice that you have yourself targeted there? or am I reading it wrong.
What happenes when you have a MOB targeted.

Chill
Contributing Member
Contributing Member
Posts: 435
Joined: Fri May 07, 2004 5:06 pm
Location: Erie, PA

Post by Chill » Tue Nov 02, 2004 10:26 am

RDPidb wrote:Could you do :

Code: Select all

#event FDFail "#1# ${Me.Name} has fallen to the ground.#*# 
??
No, but this should should work:

Code: Select all

#event FDFail "#1# has fallen to the ground."
...
Sub Event_FDFail(string Line,string FDName) 
   /if ( ${FDName.Equal[${Me.Name}]}) {
      /echo OMFG FD Failed!!
      <CODE GOES HERE>
   } 
/return
P.S. Looking up I see Alisandra pretty much just gave you this code for the event...

Rusty~
a hill giant
a hill giant
Posts: 244
Joined: Wed Apr 14, 2004 2:55 pm

Post by Rusty~ » Tue Nov 02, 2004 11:23 am

Ok.. added in the FD thing. I don't play any FD classes so it's not tested.. should work though.

Rand
a lesser mummy
a lesser mummy
Posts: 44
Joined: Sun Jun 08, 2003 8:37 am

Post by Rand » Sun Nov 07, 2004 5:53 am

While doing the french translation I found that :

#event Stunned "You cannot cast while stunned#*#"

should be :

#event Stunned "You can't cast spells while stunned!#*#"

You can find the text in eqstr_us.txt, at index 175.

botofall
decaying skeleton
decaying skeleton
Posts: 8
Joined: Thu Oct 14, 2004 2:01 am

Post by botofall » Sat Nov 13, 2004 7:51 pm

can you add anything that makes it possible to switch from 2h weapons to 2 1h weapons,,, or add a de-equip feature maby to make it simple ?

or did i miss a way to do that reading thru your file

micron1090
orc pawn
orc pawn
Posts: 11
Joined: Fri May 14, 2004 10:39 am

Post by micron1090 » Thu Dec 09, 2004 1:41 pm

First off, great include, love it.

But I have a small bug in all of my macros that use this include. If i start casting a spell that fizzles, like a nuke, and the target i'm attacking dies before i start the fizzle recast, i get stuck in an infinite loop that says 'You must first select a target for this spell!'.

i'm calling the spell using the following:

Code: Select all

  /if (${Me.SpellReady["spellname"]}) /call cast "spellname" 
I've tried faking it out by doing:

Code: Select all

Sub Event_NoTarget
   /if ( ${Defined[castReturn]} ) /varset castReturn CAST_SUCCESS
/return
but to no avail. Any ideas?

A_Druid_00
Macro Maker Extraordinaire
Posts: 2378
Joined: Tue Jul 13, 2004 12:45 pm
Location: Rolling on the Lawn Farting

Post by A_Druid_00 » Thu Dec 09, 2004 1:49 pm

Add a timeout...

Code: Select all

/call Cast "nukespell" gemX 10s
Then the longest you'll be spamming yourself is 10 seconds.
[quote]<DigitalMocking> man, A_Druid_00 really does love those long ass if statements
<dont_know_at_all> i don't use his macro because i'm frightened of it[/quote]
[quote][12:45] <dont_know_at_all> never use a macro when you can really fuck up things with a plugin[/quote]

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

Post by Cr4zyb4rd » Thu Dec 09, 2004 2:04 pm

Just noticed the FD thing a couple of posts above. I really don't see how this belongs in here at all, but "the right way" to define the event so that it only triggers on yourself is

Code: Select all

#Event FDFail "|${Me.Name}| has fallen to the ground."
This lets MQ2's extremely fast pattern matching engine look for the proper event, and saves it from triggering the subroutine at all if somebody else fails nearby.