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

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

Post by Rusty~ » Fri Jul 30, 2004 10:49 am

Is there anyway quick way to to use spell_routines.inc so that it will contunually try to cast the spell and won't stop until the spell has landed?
for instance..
not quite sure what you mean here but... if you're trying to cast a spell and keep getting interrupted, an dwant it to recast it, you can specify how long you want it to keep trying to recast. eg:

Code: Select all

/call Cast "Force Shield" gem5 10s
would keep trying to cast Force Shield for 10 seconds

Draimen
a lesser mummy
a lesser mummy
Posts: 69
Joined: Sun Jan 25, 2004 3:13 pm

Post by Draimen » Fri Jul 30, 2004 11:21 am

Thanks for the fix Rusty, will give it a try.

s0rcier
a grimling bloodguard
a grimling bloodguard
Posts: 876
Joined: Mon Aug 02, 2004 10:49 pm

Your spell did not take hold.

Post by s0rcier » Mon Aug 02, 2004 10:57 pm

Is it possible to handle those spells cast message.

1) "Your spell did not take hold."

Appends when as an example you try to cast malos on a mobs after someone cast malosinia... (malosinia being resisted more, but do better debuff) so i end up oftenly in a dead loop trying to cast malos that is unresistable on a mobs that someone malosinia. (was same i think when u were trying to cast malo after malosini... etc ...

2) "Your can only cast this spell in the outdoors."

Be cool to be able to get that error message so you wont have to code long events just to handle it!


s0rcier!

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

Post by Rusty~ » Tue Aug 03, 2004 4:05 pm

yeah i'll add in the outdoor thing... i already have it as an event in my macros just never got around to adding it to this.

as for the not hold thing. as it is now, it counts spells not holding as a success.... which it is really.... it means the spell landed, and if you use this in a macro to cast malos on something, there should be no reason to get stucin a loop since it should return that it landed successfully.

s0rcier
a grimling bloodguard
a grimling bloodguard
Posts: 876
Joined: Mon Aug 02, 2004 10:49 pm

Post by s0rcier » Wed Aug 04, 2004 10:41 pm

Well i might need to recheck for the hold thing ... or i will suggest using a global variable like checkhold or something ... i just realise that the wont hold is report also when trying to cast a lower buff on someone that have better...

I just downloaded your latest mods on the module so i will recheck the hold thing ...

Thx a lot for the nice support, just wish that was written as a plugin! hehe

s0rCier!

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

Post by Rusty~ » Thu Aug 12, 2004 2:13 pm

Made some changes to how this casts items... added in a new subroutine you can call to swap items.

Changed how interrupts work again.

By default, it will always interrupt a spell if target is lost (only spells that require targets of course) and you're not mounted. If you're mounted, and the spell you're casting has 7 seconds or longer left, it will dismount and interrupt ( if you want to use this, then you should have some code in your macro to recast mount if it's missing! ). If the spell you're casting has under 7 seconds left, but has a recast time of 3 seconds or more (like many stuns, some nukes, mana taps, etc ), it will move forward a bit to interrupt, then move back.

If you DON'T want to interrupt at all when you're on a mount, then add

Code: Select all

/declare noInterrupt int outer 1
to the top of the macro (usually with the rest of your declarations) you're calling this from (not in the include file). This will still interrupt spells if you're not mounted, as I don't see any possible down side to that.

A Troll
a lesser mummy
a lesser mummy
Posts: 30
Joined: Fri May 21, 2004 10:04 am

Post by A Troll » Sun Aug 15, 2004 5:23 am

Anyone else got the problem that this one crashes if you do an

Code: Select all

/call cast "Spellname"
?

My Code for the calls is from the old Stick.mac and dosent work since the 12.8.04

Code: Select all

    /if (${Me.Class.Name.Equal[Shadow Knight]}) /if (${Target.ID}==${MobID}) /if (!${Me.Casting.ID}) /if (${Target.Distance}<=${MeleeDistance}) /goto :attackSpellsSK 
  /goto :attackMeleeLoop 

  :attackSpellsSK 
  /echo spell
    /if (${Me.Gem["Zevfeer's Bite"]}>0) /if (${Me.PctMana}>20) /if (${Target.PctHPs}<97) /call cast "Zevfeer's Bite" 
    /if (${Me.Gem[Aura of Hate]}>0) /if (${Me.PctMana}>20) /if (${Target.PctHPs}<96) /call cast "Aura of Hate" 
    /if (${Me.Gem[Spear of Decay]}>0) /call Cast "Spear of Decay" 
    /if (${Me.Gem[Spear of Plague]}>0) /if (${Me.PctMana}>20) /if (${Target.PctHPs}<95) /call cast "Spear of Plague" 
|    /if (${Me.Gem[Bond of Death]}>0) /if (${Me.PctHPs}<90)  /if (${Me.PctMana}>20) /if (${Target.PctHPs}<90) /call cast "Bond of Death" 
  /goto :attackMeleeLoop 

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

Post by Rusty~ » Thu Aug 19, 2004 2:27 pm

ok, made big changes to this include today. pretty much rewrote most of it. hopefully the problems some people were having should be fixed by this.

also, this will now cast AA abilities again (yay)

Blazer
orc pawn
orc pawn
Posts: 12
Joined: Mon Jul 26, 2004 11:33 pm

Post by Blazer » Fri Aug 20, 2004 10:11 am

Problem with calling Subroutines with mySub being defined locally in your code..

Code: Select all

Sub Cast(string spellName,string spellType,timer giveUpTimer,string mySub)
and then trying to call mySub in another Subroutine...

Code: Select all

Sub WaitCast 
:wait_cast_loop 
   /if ( ${Defined[mySub]} ) /call ${mySub} 
This will always be NULL so any macros out their that use subroutunes with their Cast wont work.
Looks like you moved mySub in a new subroutine when you did the latest changes.

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

Post by Rusty~ » Fri Aug 20, 2004 12:02 pm

ew thanks.. yeah i missed that heh, used to have that in the main sub. i'll work on it right away

ok.. hopefully fixed it. not in game atm to check tho, but just made WaitCast take the sub as a parameter

User avatar
Night Hawk
a grimling bloodguard
a grimling bloodguard
Posts: 590
Joined: Fri Aug 13, 2004 4:56 pm

Post by Night Hawk » Fri Aug 20, 2004 2:02 pm

Line: 507

when I did a simple

/call cast "Fabled Jounryman's Boots" item

I got an error of:

"Subroutine NULL cannot be found"

I changed:

Code: Select all

/if ( ${Bool[mySub]} ) /call ${mySub}
to:

Code: Select all

/if ( !${Bool[mySub]} ) /call ${mySub}
It worked, but is this correct?

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

Post by Rusty~ » Fri Aug 20, 2004 7:25 pm

meh ok thats what i get for makin fast changes and not testing.... it used to be /if ${Defined[mySub]}, which takes the variable name as a string and doesnt need the brackets... but i changed it to bool since it will always be defined, but will be NULL if not there. as it is now, it will always call it even if you dont specify it, since that line will always be true... so it should be:

Code: Select all

/if ( ${Bool[${mySub}]} ) /call ${mySub}

User avatar
Night Hawk
a grimling bloodguard
a grimling bloodguard
Posts: 590
Joined: Fri Aug 13, 2004 4:56 pm

Post by Night Hawk » Fri Aug 20, 2004 9:48 pm

Kinda confused. Cause as I said, with that in there, it just returns null.

Also in your code:

Code: Select all

      :wait_for_mem 
      /delay 15s ${Me.SpellReady[${spellName}]} 
Should definately up the 15s. I put mine at about 45 because there are spells out there with 30second recast times, meaning after meming it, ya gotta wait 30 seconds :P

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

Post by Rusty~ » Fri Aug 20, 2004 10:13 pm

i added mySub as a parameter to WaitCast... so i /call WaitCast ${mySub}... if mySub wasn't defined, it would be NULL.

also, on the 15 second thing, if a spell takes longer than that to cast then it will return CAST_NOTREADY... which can be handled from the macro. i dont really want it to get stuck for 45s waitin for a 3 min recast spell to pop up hehe

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

A special request

Post by aChallenged1 » Sat Aug 21, 2004 12:12 am

Rusty~, would you consider taking the time to make a song_routine.inc?
Much of what is needed is already in place, but there are items which would have to be removed, and some to be adjusted.

For example: Bards don't get a 'you begin' when starting to sing a song and their fizzle is "You miss a note, bringing your song to a close!" Also, Bards stop songs either by clicking any spell gem or by the command /stopsong.

I'm already looking at the spell_routines.inc, and I will probably get there, eventually. I'm just wondering if you would care to do it, or leave it to me. The biggest problem I'm having right now with ripping this is lack of comments on what section is what. Some of it seems to blend into others and is somewhat confusing.

Thanks.
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!