simple mage macro (easily converted to all casters)

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

gnome001
a ghoul
a ghoul
Posts: 109
Joined: Fri Jan 24, 2003 1:01 am

simple mage macro (easily converted to all casters)

Post by gnome001 » Sun Nov 23, 2003 11:52 am

this is my first macro to post, and yes, its very simplistic and could probably be improved quite a bit, but it has all the functionality i need in a typical setting and none of the excess genbot does. ( much love to grimjack, but genbot bogs me down most of the time for some reason, and a 2 minute delay on commands just doesn't work)

Code: Select all

|mage.mac  this is quite a simple macro without all the functionality of the genbot for those who don't 
|desire everything that is in genbot.  i wrote this because, while genbot is great, it has too much stuff 
|in it, too much functionality i have absolutely no need of. one bonus of this is that it allows the 
|master to change targets and have the bot nuking a different target, which is very good for me.
|this could easily be converted to work for any caster of any type. 
|start this by /macro mage mastername
#chat tell 

Sub Main 
/declare MastersName global 
/varset MastersName "@Param0" 

:MainLoop 
  /doevents 
  /goto :MainLoop 
/return 

Sub Event_Chat 
  /if "@Param1"!="@MastersName" /return 
  /if "@Param2"~~"sit" /sit 
  /if "@Param2"~~"stand" /stand 
  /if "@Param2"~~"assist" /call Do-Assist
  /if "@Param2"~~"fire" /call Do-Fire
  /if "@Param2"~~"magic" /call Do-Magic
  /if "@Param2"~~"petattack" /call PetAttack
  /if "@Param2"~~"petback" /call PetBack
/return 
 
Sub Do-Assist
/assist @MastersName
/delay 1s
/tell @MastersName "Assisting you on %T"
/return

Sub Do-Fire
/sit off 
/cast "Sun Vortex" 
/delay 1s 
/tell @MastersName "Sun Vortex on %T"
/delay 6s
/return

Sub Do-Magic
/sit off
/cast Black Steel
/delay 1s
/tell @MastersName "Black Steel on %T"
/delay 6s
/return

Sub PetAttack
/pet attack
/return

Sub PetBack
/pet hold
/pet back off
/return

rencro
Custom Builder
Custom Builder
Posts: 56
Joined: Sat Sep 27, 2003 12:39 am

Post by rencro » Sun Nov 23, 2003 12:28 pm

This is slightly smaller than Genbot.

gnome001
a ghoul
a ghoul
Posts: 109
Joined: Fri Jan 24, 2003 1:01 am

Post by gnome001 » Sun Nov 23, 2003 12:35 pm

that was the idea

cheater
orc pawn
orc pawn
Posts: 26
Joined: Sat Oct 04, 2003 6:06 am

Post by cheater » Tue Dec 02, 2003 7:14 pm

I just get "you dont have that spell memorized" even if I have. Any idea whats wrong?

Guest

Post by Guest » Tue Dec 02, 2003 10:39 pm

Change the spell names to be in quotes...

e.g.

/cast Voice of Quellious doesn't work, yet

/cast "Voice of Quellios" does.

*Quack*

uglyshaman

Post by uglyshaman » Wed Dec 03, 2003 12:38 pm

Any idea how you could get the caster to use a clickable item repeatedly, until told not to? (ie: JBB, etc).

gnome001
a ghoul
a ghoul
Posts: 109
Joined: Fri Jan 24, 2003 1:01 am

Post by gnome001 » Wed Dec 03, 2003 1:07 pm

you could set up a tell that makes you stop doing whatever you are doing, and another command that sets upa loop to click the item...

not too sure of the specifics of how the code would look as i am really a novice macro writer and this simple script just about covers the extent of my abilities... i'll work on it a little bit and see if i can come up with something..

untested as of now.. (just to give you a basic idea of something to play with.. )

add this into the Sub Event_Chat

Code: Select all

  /if "@Param2"~~"itemcast" /call itemcast

new sub to add at the bottom

Code: Select all

Sub ItemCast
/sit off
:loopstart
/cast item "item name"
/delay (set your delay here to include cast time and recast time)
/if "@Param2"~~"stop" /return else 
/goto :loopstart
/return

Azum
a hill giant
a hill giant
Posts: 229
Joined: Wed Jun 04, 2003 5:04 am

Modified to use with a wizard, and item cast support.

Post by Azum » Wed Dec 03, 2003 6:00 pm

I modified and use this with my wizard occasionally, need to add some more features, but for now it works. If you notice it uses Staff of Temperate Flux, could switch the spells and items to suit your needs. Casts Force Shield and Allegiant Familiar automatically when they wear off. Code stolen from all over. Macro and spellcast.inc. Copy em both.

Code: Select all

#include spellcast.inc
#chat tell 

Sub Main 
/declare MastersName global 
/varset MastersName "@Param0" 

:MainLoop 
  /call CheckBuffs
  /doevents 
  /goto :MainLoop 
/return 

Sub Event_Chat 
  /if "@Param1"!="@MastersName" /return 
  /if "@Param2"~~"sit" /sit 
  /if "@Param2"~~"stand" /stand 
  /if "@Param2"~~"assist" /call Do-Assist
  /if "@Param2"~~"fire" /call Do-Fire
  /if "@Param2"~~"magic" /call Do-Magic
  /if "@Param2"~~"petattack" /call PetAttack
  /if "@Param2"~~"petback" /call PetBack
  /if "@Param2"~~"ice" /call Do-Ice
  /if "@Param2"~~"concussion" /call Do-Concussion
  /if "@Param2"~~"follow" /call Do-Follow

/return 
 
Sub Do-Assist
/assist @MastersName
/delay 1s
/tell @MastersName Hey it's %T
/return

Sub Do-Fire
/sit off 
/press left
/call Cast "Staff of Temperate Flux" item
/delay 5
/call Cast "Strike of Solusek"
/tell @MastersName Strike of Solusek on %T
/return

Sub Do-Ice
/sit off 
/press left
/call Cast "Staff of Temperate Flux" item
/delay 5
/call Cast "Ice Meteor"
/tell @MastersName Ice Meteor on %T
/return

Sub Do-Magic
/sit off
/press left
/call Cast "Staff of Temperate Flux" item
/delay 5
/call Cast "Agnarr's Thunder"
/tell @MastersName Agnarr's Thunder on %T
/return

Sub Do-Concussion
/sit off
/press left
/call Cast "Concussion"
/tell @MastersName Concussion on %T
/return

Sub Do-Follow
/sit off
/target @MastersName
/delay 1s
/follow @MastersName
/tell @MastersName Following you bish
/return


Sub PetAttack
/pet attack
/return

Sub PetBack
/pet hold
/pet back off
/return

Sub CheckBuffs 

  /call SelfBuff "Force Shield" 
  /call Familiar "Allegiant Familiar"
/return 



Sub SelfBuff 

  /if n $char(buff,"@Param0")==0 { 
  /call Cast "@Param0" 
} 
/return 

Sub Familiar
  /if n $char(buff,"@Param0")==0 { 
    /alt activate 52
    /delay "$calc($spell("@Param0",Casttime)+2.25)"s 
  }
/return
Spellcast.inc

Code: Select all

| SpellCast.inc 
| This will cast a spell reliably for you... 
| Usage: 
| /call Cast "spellname" [item] 
| 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 
| Oct 15, 2003 - Item support added by EqMule 


#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,Item) 
:StartCast 
  /if "@Item"=="Item" { 
  /call ClearReturnValue 
  /cast item "@SpellName" 
} else { 
  /if n $char(gem,"@SpellName")==0 /return CAST_UNKNOWNSPELL 
  /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 
Things I'd like to do, are add another parameter calld something like AssistName. So you'd start the macro with two parameters like so - /macro wiz Mastersname AssistName. Then just change the assist code to assist the AssistName. I have had limited success but I'm not sure how to do it cleanly and efficiently. Then what I'd like it to do is just periodically assist the AssistName and check to see if the health of the mob is at a certain percent - then the bot would chain nuke/concussion til it was dead. Unfortunately I'm not the greatest code writer.

gnome001
a ghoul
a ghoul
Posts: 109
Joined: Fri Jan 24, 2003 1:01 am

Post by gnome001 » Thu Dec 04, 2003 11:23 am

one thing i noticed. you might wanna be careful with how you name your subs.. for instance i was in sol ro the other day and was using this and was sending tells to cast my magic spell on a mob with fire in the name.. the macro would see magic and then fire and try to cast magic and then the fire spell. its easy to fix btw.. just change your command triggers to something that doesn't appear in the mob's name... for instance just change the fire trigger to SunV or something like that..