Need Macro to mez mob indefinitely, checking fizzles etc.

Got a cool macro idea? Wanna request a macro? Here is the place for you!

Moderator: MacroQuest Developers

Xegonite
decaying skeleton
decaying skeleton
Posts: 5
Joined: Sun Oct 12, 2003 10:43 pm

Need Macro to mez mob indefinitely, checking fizzles etc.

Post by Xegonite » Thu Oct 16, 2003 1:39 am

This probably is pretty easy for one of you solid coders but alas that I am not. Any help would be appreciated with possible donation to your paypal fund.

[40oz]
a hill giant
a hill giant
Posts: 156
Joined: Tue Nov 12, 2002 12:14 pm

Post by [40oz] » Thu Oct 16, 2003 2:43 am

Grats on getting to the Rathe~

Here's a really basic script. If you want a feature thats not htere, let me know.

This mob kept an untashed corrupted pusling in crypt of decay mezzed for 20 minutes with a decently equipped 65 chanter, stayed at 100 mana almost the entire time.

If you are using this on the rathe, as per my sarcastic comment above, I suggest not adding any features, and keeping a close eye on your surroundings. I've played an enchanter, sk, and bard on this encounter so many times and no matter what you ahve to pay attention. but if you're being lazy, this will help you not forget to remez =)

Save the following as "spellcast.mac"

Code: Select all

|Plazmic + 1 line change by Imperfect

|** SpellCast.inc
** This will cast a spell reliably for you...
** Usage:
** /call Cast "spellname"
** It will return the following values:
** CAST_SUCCESS
** CAST_UNKNOWNSPELL
** CAST_OUTOFMANA
** CAST_OUTOFRANGE
** CAST_CANNOTSEE
** CAST_STUNNED
** CAST_RESISTED
**
** New Vars Modification
** Plazmic's no globals needed version
**|

|Oct 9, 2003 - Updated to work with new vars and $char(casting) - gf
|Oct 11, 2003 - switched some logic, removed defines - gf


#event Fizzle "Your spell fizzles!"
#event Interrupt "Your casting has been interrupted!"
#event Interrupt "Your spell is interrupted."
#event Recover "You haven't recovered yet..."
#event Recover "Spell recovery time not yet met."
#event Resisted "You target resisted the "
#event OutOfMana "Insufficient Mana to cast this spell!"
#event OutOfRange "Your target is out of range, get closer!"
#event NoLOS "You cannot see your target."
#event Stunned "You cannot cast while stunned"
#event Standing "You must be standing to cast a spell"
#event Collapse "Your gate is too unstable, and collapses."

Sub Cast(SpellName)
  /if n $char(gem,"@SpellName")==0 /return CAST_UNKNOWNSPELL
  :StartCast
  /call ClearReturnValue
  /if n $char(gem,"@SpellName")<0 {
     /delay 0
     /goto :StartCast
  }
  /cast "@SpellName"

  :WaitCast
     /if "$char(casting)"=="TRUE" {
       /delay 1
       /goto :WaitCast
     }
     /doevents Fizzle
     /doevents Interrupt
     /doevents Recover
     /doevents Standing
     /doevents OutOfRange
     /doevents OutOfMana
     /doevents NoLOS
     /doevents Resisted
     /if "$return"=="CAST_RESTART" /goto :StartCast
     /if "$return"!="CAST_SUCCESS" /return "$return"
/return CAST_SUCCESS

Sub ClearReturnValue
/return CAST_SUCCESS

Sub Event_Fizzle
/return CAST_RESTART

Sub Event_Interrupt
/return CAST_RESTART

Sub Event_Recover
   /delay 5
/return CAST_RESTART

Sub Event_Standing
   /stand
/return CAST_RESTART

Sub Event_Collapse
/return CAST_RESTART

Sub Event_OutOfMana
/return CAST_OUTOFMANA

Sub Event_OutOfRange
/return CAST_OUTOFRANGE

Sub Event_NoLOS
/return CAST_CANNOTSEE

Sub Event_Stunned
/return CAST_STUNNED

Sub Event_Resisted
/return CAST_RESISTED 
And here is your macro, call it "mezmob.mac" or whatever, just so you know so you can run it:

Code: Select all

| mezmob.mac
| by [40oz]
|
| Usage: /macro mezmob
|  -- Have mob on target you want to mez indefinately.
|  -- Have your mez spell memmed, and check that it's the same as the /varset mezSpell
|
| This macro will mez the mob on your target indefinately, it does nothing but keep track
| of time and mez.  If you are moving, it will catch the interrupt of the cast.  It also
| takes care of resists, stuns, etc.

#include spellcast.mac

#turbo

Sub Main
   | ----Declares
   /declare mezSpell local
   /declare recastTime local
   /declare sitFlag local

   | ----CHANGE THESE AS APPROPRIATE----

   /varset mezSpell "Bliss"	| Spell to mez with.
   /varset recastTime 400	| Number of miliseconds to wait before recasting between successful mezzes
   /varset sitFlag 1		| Sit after mez?  1 for yes, 0 for no.

   | ----CHANGE THESE AS APPROPRIATE----

   /if $target()==FALSE {
      /echo No mob on target to mez.
      /return
   }

   /declare targetID local
   /varset targetID $target(id)

   /echo Keeping $target(name,clean) mezzed!

   :castLoop
      /doevents
      /stand
      /call Cast "@mezSpell"
      /if n $return==CAST_SUCCESS {
         /if n @sitFlag==1 /sit
         /delay @recastTime
      }
   /if n $target(id)==@targetID /goto :castLoop

   /echo EXITING ---- EXITING
/return

Xegonite
decaying skeleton
decaying skeleton
Posts: 5
Joined: Sun Oct 12, 2003 10:43 pm

Getting error when running mezmob.mac

Post by Xegonite » Thu Oct 16, 2003 3:19 am

I copied both the pieces of code into their respective .mac files.

I am getting this error:

Ending macro: Subroutine Cast wasn't found
mezmob.mac@43 (Main): /call cast "@mezSpell"

Any clue what this could be? Thanks again in advance.

User avatar
ap50
a snow griffon
a snow griffon
Posts: 425
Joined: Sun Aug 18, 2002 2:29 pm

Post by ap50 » Thu Oct 16, 2003 10:21 am

#include spellcast.mac

should be

#include spellcast.inc

if you've saved it as per the description in the include, rather than how it was told you to do in the message.

And wouldn't @mezSpell be needed to be declared as a global, rather than local variable ?
[color=yellow][size=92][b]Just because you're paranoid, it doesn't mean everyone isn't out to get you![/b][/size][/color]

[40oz]
a hill giant
a hill giant
Posts: 156
Joined: Tue Nov 12, 2002 12:14 pm

Post by [40oz] » Thu Oct 16, 2003 2:43 pm

That's a type-o on my part, i copied it while i was still in the middle of testing some extra features i thought about putting in.

capitalize the C in cast... so:

Code: Select all

/call Cast "@mezMob"



ap50: locals work just fine. theres this thing called passing arguments. it works.

Xegonite
decaying skeleton
decaying skeleton
Posts: 5
Joined: Sun Oct 12, 2003 10:43 pm

Sigh still not working.

Post by Xegonite » Thu Oct 16, 2003 5:12 pm

Same exact error as before

Ending macro: Subroutine Cast wasn't found
mezmob.mac@43 (Main): /call Cast"@mezSpell

In your initial code "Cast" was capitolized in all places. Also I did change it to spellcast.inc vs. .mac and its the same thing. Ugh it seems so close yet not quite working. Any idea on what else I should do?

EqMule
Developer
Developer
Posts: 2697
Joined: Fri Jan 03, 2003 9:57 pm
Contact:

Post by EqMule » Thu Oct 16, 2003 9:06 pm

try deleting all the comments...
My status o/
If you like MQ2 and would like to contribute, please do. My goal is 25 donations per month.
So far I've received Image donations for this month's patches.

Bitcoin: 1Aq8ackjQ4f7AUvbUL7BE6oPfT8PmNP4Zq
Krono: PM me.
I can always use characters for testing, PM me if you can donate one.

Xegonite
decaying skeleton
decaying skeleton
Posts: 5
Joined: Sun Oct 12, 2003 10:43 pm

Ugh ...

Post by Xegonite » Fri Oct 17, 2003 7:39 pm

/groan It still doesn't work, I wish i could quit bothering you fine people and do it myself but alas at this point I don't have the skills. If anyone here could get it running for themselves and let me know the changes I would be greatly appreciative.

C

blakbelt
a lesser mummy
a lesser mummy
Posts: 70
Joined: Wed Aug 27, 2003 12:40 pm
Location: Scotland UK

Post by blakbelt » Sat Oct 18, 2003 4:07 am

Rather than /call Cast try just /cast @MezMob...??
Blakbelt

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Sat Oct 18, 2003 6:01 am

One think I see that might cause a problem eventually is the line in blue below:

Code: Select all

   :castLoop 
      /doevents 
      /stand 
      /call Cast "@mezSpell" 
      [color=cyan]/if n $return==CAST_SUCCESS {[/color]
         /if n @sitFlag==1 /sit 
         /delay @recastTime 
      } 
   /if n $target(id)==@targetID /goto :castLoop 

   /echo EXITING ---- EXITING 
/return
I think that line should be changed to

Code: Select all

      [color=cyan]/if $return==CAST_SUCCESS {[/color]
since it is not a numeric comparison, at least not from what I see.

Also try modifying the Sub Cast to what is shown below. I have found greater success using @Param# versus user defined variables.

Code: Select all

Sub Cast
  /if n $char(gem,"@Param0")==0 /return CAST_UNKNOWNSPELL 
  :StartCast 
  /call ClearReturnValue 
  /if n $char(gem,"@Param0")<0 { 
     /delay 0 
     /goto :StartCast 
  } 
  /cast "@Param0" 

  :WaitCast 
     /if "$char(casting)"=="TRUE" { 
       /delay 1 
       /goto :WaitCast 
     } 
     /doevents Fizzle 
     /doevents Interrupt 
     /doevents Recover 
     /doevents Standing 
     /doevents OutOfRange 
     /doevents OutOfMana 
     /doevents NoLOS 
     /doevents Resisted 
     /if "$return"=="CAST_RESTART" /goto :StartCast 
     /if "$return"!="CAST_SUCCESS" /return "$return" 
/return CAST_SUCCESS

koad
Plugins Czar
Posts: 127
Joined: Fri May 16, 2003 8:32 pm

Post by koad » Sat Oct 18, 2003 6:09 am

i think the extended comments parsing is messed up- some slight changes to the include and the sub was successfull called, and my level18 enchanter mezzed a giant spider for an hour before i remembered i had him logged in

i also noticed that if you have sit turned on, the cast sub exits so fast command line is not ready to accept /sit and says "YOu cannot use that command while casting" crap ~ so if sit is enabled script waits 5ms - seems to fix that prob


mezmob.mac

Code: Select all

| mezmob.mac 
| by [40oz] 
| 
| Usage: /macro mezmob 
|  -- Have mob on target you want to mez indefinately. 
|  -- Have your mez spell memmed, and check that it's the same as the /varset mezSpell 
| 
| This macro will mez the mob on your target indefinately, it does nothing but keep track 
| of time and mez.  If you are moving, it will catch the interrupt of the cast.  It also 
| takes care of resists, stuns, etc. 

#include spellcast.mac

#turbo 

Sub Main 
   | ----Declares 
   /declare mezSpell local 
   /declare recastTime local 
   /declare sitFlag local 

   | ----CHANGE THESE AS APPROPRIATE---- 

   /varset mezSpell "Bliss"   | Spell to mez with. 
   /varset recastTime 400   | Number of miliseconds to wait before recasting between successful mezzes 
   /varset sitFlag 1      | Sit after mez?  1 for yes, 0 for no. 

   | ----CHANGE THESE AS APPROPRIATE---- 

   /if $target()==FALSE { 
      /echo No mob on target to mez. 
      /return 
   } 

   /declare targetID local 
   /varset targetID $target(id) 

   /echo Keeping $target(name,clean) mezzed! 

   :castLoop 
      /doevents 
      /stand 
      /call Cast "@mezSpell" 
      /if n $return==CAST_SUCCESS { 
         /if n @sitFlag==1 {
           [b]/delay 5[/b]
           /sit
         }
         /delay @recastTime 
      } 
   /if n $target(id)==@targetID /goto :castLoop 

   /echo EXITING ---- EXITING 
/return
spellcast.mac

Code: Select all

|Plazmic + 1 line change by Imperfect 

[b]| SpellCast.inc 
| This will cast a spell reliably for you... 
| Usage: 
| /call subCast "spellname" 
| It will return the following values: 
| CAST_SUCCESS 
| CAST_UNKNOWNSPELL 
| CAST_OUTOFMANA 
| CAST_OUTOFRANGE 
| CAST_CANNOTSEE 
| CAST_STUNNED 
| CAST_RESISTED 
| New Vars Modification [/b]

|* Plazmic's no globals needed version 

|Oct 9, 2003 - Updated to work with new vars and $char(casting) - gf 
|Oct 11, 2003 - switched some logic, removed defines - gf 


#event Fizzle "Your spell fizzles!" 
#event Interrupt "Your casting has been interrupted!" 
#event Interrupt "Your spell is interrupted." 
#event Recover "You haven't recovered yet..." 
#event Recover "Spell recovery time not yet met." 
#event Resisted "You target resisted the " 
#event OutOfMana "Insufficient Mana to cast this spell!" 
#event OutOfRange "Your target is out of range, get closer!" 
#event NoLOS "You cannot see your target." 
#event Stunned "You cannot cast while stunned" 
#event Standing "You must be standing to cast a spell" 
#event Collapse "Your gate is too unstable, and collapses." 

Sub Cast(SpellName) 
  /if n $char(gem,"@SpellName")==0 /return CAST_UNKNOWNSPELL 
  :StartCast 
  /call ClearReturnValue 
  /if n $char(gem,"@SpellName")<0 { 
     /delay 0 
     /goto :StartCast 
  } 
  /cast "@SpellName" 

  :WaitCast 
     /if "$char(casting)"=="TRUE" { 
       /delay 1 
       /goto :WaitCast 
     } 
     /doevents Fizzle 
     /doevents Interrupt 
     /doevents Recover 
     /doevents Standing 
     /doevents OutOfRange 
     /doevents OutOfMana 
     /doevents NoLOS 
     /doevents Resisted 
   /if "$return"=="CAST_RESTART" /goto :StartCast 
   /if "$return"!="CAST_SUCCESS" /return "$return" 
/return CAST_SUCCESS 

Sub ClearReturnValue 
/return CAST_SUCCESS 

Sub Event_Fizzle 
/return CAST_RESTART 

Sub Event_Interrupt 
/return CAST_RESTART 

Sub Event_Recover 
   /delay 5 
/return CAST_RESTART 

Sub Event_Standing 
   /stand 
/return CAST_RESTART 

Sub Event_Collapse 
/return CAST_RESTART 

Sub Event_OutOfMana 
/return CAST_OUTOFMANA 

Sub Event_OutOfRange 
/return CAST_OUTOFRANGE 

Sub Event_NoLOS 
/return CAST_CANNOTSEE 

Sub Event_Stunned 
/return CAST_STUNNED 

Sub Event_Resisted 
/return CAST_RESISTED 

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Sat Oct 18, 2003 11:52 am

I still don't see how:

Code: Select all

      /if n $return==CAST_SUCCESS { 
         /if n @sitFlag==1 { 
           /delay 5 
           /sit 
         } 
is a numeric comparison. Is CAST_SUCCESS or any of the other returns from spellsub.mac a numeric value? I don't think sitFlag comparison is ever tested.

JimJohnson
a grimling bloodguard
a grimling bloodguard
Posts: 1299
Joined: Sat Oct 11, 2003 6:00 am

Post by JimJohnson » Mon Dec 08, 2003 11:43 am

anyway to have this rotate between 2 -3 mobs and hold them mezzed?

[40oz]
a hill giant
a hill giant
Posts: 156
Joined: Tue Nov 12, 2002 12:14 pm

Post by [40oz] » Mon Dec 08, 2003 3:34 pm

Your right Wassup, this is an old still buggy copy. I PMed him the final stuff a while back. Lemme post it here for those that want.

As to multiple mob mez - yes theres a way, but it's not very pretty. The best you can do is keep everything in a radius mezzed. That would include mobs that are being fought. I've been drummin on a how to build an auto buff auto mez auto slow chanter bot for a while. The best I've come up with is a way to only half play the chanter. It will auto assist the tank and will tash/slow a mob once it hits 96 pct health, and it will renew mezzes on any mob you mez first. Thats the best I could come up with. I'd rather not have to touch the enchanter bot though, thats my hope at any rate. IF I think of a good way to do auto mezzing I'll share.

Code: Select all

| mezmob.mac
| by [40oz]
|
| Usage: /macro mezmob
|  -- Have mob on target you want to mez indefinately.
|  -- Have your mez spell memmed, and check that it's the same as the /varset mezSpell
|
| Seconday Usage: /macro mezmob MezSpell RecastTime SitFlag
|  -- Have mob on target to mez
|  -- Must pass parameters in this order or it will not work.
|  -- You may pass just the MezSpell, or you may pass MezSpell and RecastTime, but you cannot pass
|     a parameter without passing the ones before it.
|
| This macro will mez the mob on your target indefinately, it does nothing but keep track
| of time and mez.  If you are moving, it will catch the interrupt of the cast.  It also
| takes care of resists, stuns, etc.

#include Spellcast.inc

#turbo

Sub Main
   | ----Declares
   /declare mezSpell local
   /declare recastTime local
   /declare sitFlag local

   | ----CHANGE THESE DEFAULT SETTINGS AS APPROPRIATE----

   /varset mezSpell "Bliss"	| Spell to mez with.
   /varset recastTime 500	| Number of miliseconds to wait before recasting between successful mezzes
   /varset sitFlag 1		| Sit after mez?  1 for yes, 0 for no.

   | ----CHANGE THESE DEFAULT SETTINGS AS APPROPRIATE----

   /if $defined(Param0)==TRUE /varset mezSpell @Param0
   /if $defined(Param1)==TRUE /varset recastTime @Param1
   /if $defined(Param2)==TRUE /varset sitFlag @Param2

   /if $target()==FALSE {
      /echo No mob on target to mez.
      /return
   }

   /declare targetID local
   /varset targetID $target(id)

   /echo Keeping $target(name,clean) mezzed!

   :castLoop
      /doevents
      /stand
      /call Cast "@mezSpell"
      /delay 1
      /if $return==CAST_SUCCESS {
         /if n @sitFlag==1 /sit
         /delay @recastTime
      }
   /if n $target(id)==@targetID /goto :castLoop

   /echo EXITING ---- EXITING
/return
I shouldn't need to repost Spellcast.inc - it's plaz's no globals version and works like a charm every time.

blindrebel7
decaying skeleton
decaying skeleton
Posts: 2
Joined: Sun Jan 25, 2004 8:34 pm

Post by blindrebel7 » Sun Jan 25, 2004 8:54 pm

I'm having problems getting it to recast if the mez gets resisted. Any suggestions on how to fix this?