Advanced Autofight Macro v1.2 (Tailored for Beastlord)

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

Moderator: MacroQuest Developers

blamstick
orc pawn
orc pawn
Posts: 27
Joined: Sat Sep 06, 2003 6:50 pm

Advanced Autofight Macro v1.2 (Tailored for Beastlord)

Post by blamstick » Sat Feb 14, 2004 9:00 pm

This is my autofight macro and it works well enough now that I thought I would share it with you. I took a lot of things from other people's work and made it all flow together along with a lot of my own code. It's designed to suit a beastlord but can be easily modded to suit other classes.

Before using it, first setup your on/off values at the beginning. Also you will need to change your pet name and avatar weapon names.

If you have to go semi-afk during a raid you can turn on the auto MA assist and follow commands which will follow the tank around and also assist him. When using the auto assist feature, I recommend you edit eqclient.ini and set your AttackOnAssist=FALSE if you have the auto MA assist feature turned on (so you don't break mez's).

usage: /mac autofight MAname SAname MTname STname
or just manually select a target and do /mac autofight

I recommend you setup an alias in the INI file which would be: /aafight=/macro aafight11
Then just make a hotkey which has /aafight or /aafight tankname to begin.

Features include:
-Avatar Switcher (taken from kavatar.mac -- koad)
-Spell Casting on/off
-Tank mode on/off
-Multiple assists and manual targeting
-Auto assist mode (taken from Jay's autorogue script)
-AE call announcement
-Mob health announcement
-Tank auto-follow
-Auto AE paragon
-Auto pet heal
-Auto enrage detection
-Quick quit - just duck to end the macro
-Movebehind on/off
-Move to anchor spot on/off
-Cast slows on/off
-Auto cast SD when you are autoassisting someone; also an audible beep if someone sends you a tell for SD. Can uncomment a line to play wav or mp3 files as well.
-Send a genbot a command to autoassist after you engage a mob
-Camps out if you die or someone succors to the zonein


It also uses Plazmic's modded spellcast.inc that was modded for Fsck's LazyRaid.mac with a couple of changes by me, although you can change that to be whatever spellcasting routine you'd like to use.

Code: Select all

|Advanced Autofight aafight11.mac v1.2 3/1/04 - Blamstick
#include spellcast2.inc
#chat tell
#Event Loading "LOADING, PLEASE WAIT..."
#Event Slain "You have been slain by"
#Event SlowResist "Your target resisted the Sha`s Revenge spell." 
#Event Slowed "loses their fighting edge" 
#Event Petoor "Your target is out of range, get closer!"

#event Loading "You have been slain by a" 
#event avatarfade "The Avatar departs." 
#event avatarproc "Your body screams with the power of an Avatar."

#event AEpoearbitor "has been judged by the elements "
#event AEpowofossaa "is surrounded by an icy mist"
#event AEsolro "body burns in solar winds"
#event AEsttjudawos "staggers around shivering"
#event AEpowthewise "been struck by a tidal freeze"  | Tidal Freeze 

#event petrage "xxxxx warder has become ENRAGED." |insert pet name
#event rageon "has become ENRAGED"
#event rageoff "is no longer enraged"

#define AVATARWEAPON "Ancient Prismatic Fist Wraps" 
#define NORMALWEAPON "Battle Fists" 
| primary  or  secondary 
#define WEAPONSLOT   secondary

#include spellcast2.inc

#turbo 25

Sub Main

/declare monitorhp global
/declare MobShouldFace global
/declare ragevar global
/declare mytimer timer
/declare mytimer2 timer
/declare mytimer3 timer
/declare aetimer timer
/declare doonce global
/declare useavatar global
/declare aecheck global
/declare castnukes global
/declare tanking global
/declare aggrospell global
/declare named global
/declare aevar global
/declare aepara global
/declare parahealth global
/declare MA global
/declare SA global
/declare MT global
/declare ST global
/declare aename global
/declare autoassist global
/declare assisthealth global
/declare engagedistance global
/declare tempvar   global
/declare getbehind global
/declare followma global
/declare spellstatus global
/declare slowattempts global
/declare maxslowattempts global
/declare slowcounter global
/declare castslows global
/declare anchor global
/declare xpos global
/declare ypos global
/declare botassist global
/declare botname global
/declare firetables global
/declare hohzonein global
/declare countdown global 
/declare MyXLoc global 
/declare MyYLoc global

/varset maxslowattempts 2
/varset slowcounter 0
/varset aename " "
/varset MA "@Param0"  | Set Main Assist Tank.
/varset SA "@Param1"  | Set Secondary Assist Tank.
/varset MT "@Param2"  | Set Main Assist Tank.
/varset ST "@Param3"  | Set Secondary Assist Tank.
/varset ragevar 0
/varset mytimer 4s 
/varset mytimer2 4s
/varset mytimer3 4s
/varset aetimer 0s
/varset aggrospell 0
/varset doonce 0
/varset aevar 0
/varset tempvar 0

/varset firetables 0 |set to 1 if xp'ing a the tables in plane of fire
/varset hohzonein 0 | set to 1 if xp'ing at the zone-in in halls of honor

/varset botassist 0   |set to 1 if you want to use bot assist commands to a 2nd PC
/varset botname "genbotname" | set to the name of the genbot
/varset anchor 0      | set to 1 to move to anchor after combat
/varset xpos -412     | set to x anchor position
/varset ypos -2747    | set to y anchor position
/varset castslows 0   | set to 0 for off, 1 for on - SLOW MOBS
/varset autoassist 0  | set to 0 for off, 1 for on - AUTO ASSIST MA YES/NO
/varset followma  0   | Follows near MA while waiting for target
/varset assisthealth 97    | Wait until mob is below this health trigger
/varset engagedistance 150 | How close mob must be to engage
/varset monitorhp 0   | set to 0 for off, 1 for on - ANNOUNCE MOB HP's
/varset aecheck   0   | set to 0 for off, 1 for on - CALL AE's
/varset useavatar 0   | set to 0 for off, 1 for on - AVATAR SWITCHER
/varset castnukes 1   | set to 0 for off, 1 for on - CAST SPELLS
/varset tanking   0   | set to 0 for off, 1 for on - ON FOR TANKING
/varset aepara    0   | set to 0 for off, 1 for on - AE PARAGON
/varset parahealth 65 | set AE PARAGON MOB HEALTH %
/varset getbehind 0   | enable/disable movebehind

/if @firetables==1 {
/varset anchor 1      | set to 1 to move to anchor after combat
/varset xpos -1337    | set to x anchor position
/varset ypos -152     | set to y anchor position
}

/if @hohzonein==1 {
/varset anchor 1      | set to 1 to move to anchor after combat
/varset xpos -412     | set to x anchor position
/varset ypos -2747    | set to y anchor position
}

/if $char(state)!=STAND /stand
/if n @anchor==1 /call GoToLoc @xpos @ypos
:Startit
/echo Checking Manual Targets
/if "$target()"=="TRUE" /if "$target(type)"=="NPC" {
/echo MANUALLY SELECTED TARGET - $target(name,clean)
/goto :Begin
}

/if n @autoassist==1 {
/echo AUTO ASSISTING MAIN ASSIST TANK - @MA
/goto :Assistloop
}

/echo Checking MA Targets
/press esc
/assist @MA
/delay 3
/if "$target()"=="TRUE" /if "$target(type)"=="NPC" {
/echo ASSISTING MAIN ASSIST TANK - @MA
/goto :Begin
}

/echo Checking SA Targets
/press esc
/assist @SA
/delay 3
/if "$target()"=="TRUE" /if "$target(type)"=="NPC" {
/echo ASSISTING SECONDARY ASSIST TANK - @SA
/goto :Begin
}

/echo Checking MT Targets
/press esc
/assist @MT
/delay 3
/if "$target()"=="TRUE" /if "$target(type)"=="NPC" {
/echo ASSISTING MAIN TANK - @MT
/goto :Begin
}

/echo Checking ST Targets
/press esc
/assist @ST
/delay 3
/if "$target()"=="TRUE" /if "$target(type)"=="NPC" {
/echo ASSISTING SECONDARY TANK - @ST
/goto :Begin
}

/echo NO TARGETS SELECTED
/endmacro

:Assistloop
/if n $char(buff,"Spiritual Dominion")==0 /if n @autoassist==1 /call SDcheck
   /if n @followma==1 {
         /tar PC @MA
         /if "$target()"!="TRUE" {
         /echo Auto Follow Turned OFF. No MA Nearby.
         /varset followma 0
         /varset autoassist 0
         /goto :Startit
         }
          :Movin
        /if n $target(distance)<=10 /goto :Nomove
          /if n $target(distance)>20 /sendkey down up
          /if n $target(distance)<10 /sendkey up up
          |/sendkey up up
          /face fast
          /delay 0
          /call quickquit
          /if n $target(distance)>20 /goto :Movin
     :Nomove  
   }
   /call quickquit
   |/sendkey down up
   /sendkey up up
   |/sendkey down down
   /sendkey up down
   /assist @MA
   /delay 2s
   /if "$target()"=="FALSE" { 
      |/target PC @MA
      |/delay 2s
      |/face 
      /goto :Assistloop
   } 
   /if "$target(type)"!="NPC" { 
      |/face
      /goto :Assistloop
   } 
/if n @tempvar!="$target(hp,pct)" /echo $target(name,clean) targeted at $target(hp,pct)% at distance $target(distance). 
   /varset tempvar "$target(hp,pct)" 
   /face 

   /if n "$target(hp,pct)"<=@assisthealth /if n "$target(distance,noprodict)<@engagedistance" /if n "$target(pet)==0" /goto :DoubleCheck 
   /Attack off 
   /doevents 
/goto :Assistloop

:DoubleCheck 
   /delay 10 
   /if n "$target(hp,pct)"<=@assisthealth /if n "$target(distance)<@engagedistance" /if n "$target(pet)==0" /goto :Begin
   /doevents
   /goto :Assistloop

:Begin
/if "$target()"=="TRUE" {
/attack on
/pet attack
}
/if n @botassist==1 /tell @botname assist2
/face fast
/echo ATTACKING $target(name,clean) !
/if $char(state)!=STAND /stand
/if n @castslows==1 /call CastSlow
 :Loop
      /doevents
   	
      /call quickquit
      
      /if "$target()"=="TRUE" /if n @aecheck==1 /call announceae
      /if "$target()"=="TRUE" /if n @useavatar==1 /call avatarswitch
      /if "$target()"=="TRUE" /if n @castnukes==1  /call castspells
      /if "$target()"=="TRUE" /if n @tanking==1  /call tankit
       
      /if "$target()"=="TRUE" /if n @aepara==1 /call aeparagon
       
     /call checkhealth
   
     /face fast   
     /if n $target(distance)>=16 /sendkey down up  |If target is farther then 18 move forward 
     /if n $target(distance)>=14 /sendkey down up
     /if n $target(distance)<=11 /sendkey up up    |If target is closer then 10 stop moving forward 
     /if n $target(distance)<=9 /sendkey up up
     /if "$target()"=="TRUE" /if n @monitorhp==1 /call announcehp
     /if "$target()"=="TRUE" /if @ragevar==0 /attack on 
      /face fast
      /if $char(ability,"Kick")>0 /if @ragevar==0 /if n $target(distance)<=15 /doability "Kick"    
      
      /if n @getbehind==1 /call movebehind
      
      /if "$target()"=="TRUE" /goto :Loop 
      
       /attack off
       /echo MOB DEAD
       
       /sendkey down up
       /sendkey up up
       /press esc
       /if n @anchor==1 /call GoToLoc @xpos @ypos
       /if n @autoassist==1 {
       /echo "Waiting for @MA to select a new target..."
       /goto :Assistloop 
       }
      /endmacro keep keys
/return

Sub Event_Chat(ChatType,Sender,ChatText) 
/if "@ChatText"~~"sd" { 
|/exec c:\space.wav bg
/beep
/beep
} 
/return

Sub avatarswitch
          /if n $char(buff,"Avatar")==0 { 
              /if "$equip(WEAPONSLOT,name)"!="AVATARWEAPON" /call equipavatar        
          } 
          /if n $char(buff,$char(buff,"Avatar"),duration)<=10 { 
              /if "$equip(WEAPONSLOT,name)"!="AVATARWEAPON" /call equipavatar 
          } 
          /if n $char(buff,"Avatar")!=0 /if n $char(buff,$char(buff,"Avatar"),duration)>10 /if "$equip(WEAPONSLOT,name)"!="NORMALWEAPON" /call equipnormal 
/return

Sub aeparagon
/if n $target(hp,pct)>=@parahealth+1 /if n $target(hp,pct)<=@parahealth-1 {
     /attack off
     /sendkey down up
     /sendkey up up
     /rs AE PARAGON INC!!
     /delay 2
     /alt activate 35
     /delay 2
     /alt activate 128
     /delay 7s
     }
/return

Sub movebehind 
   /if $target()==FALSE { 
      /attack off 
      /sendkey up up 
      /return 
   } 
     /varset countdown 0 
     /varset MyXLoc $char(x) 
     /varset MyYLoc $char(y)
     /if n $distance($calc($target(y)-$cos($target(heading))*10),$calc($target(x)-$sin($target(heading))*10))<8 /goto :noneed 
     /if $target()==FALSE /return 
     /sendkey down up 
     :gobehindloop 
     /if $target()==FALSE { 
        /attack off
        /sendkey up up 
        /return 
     } 
     /if n @countdown>=20 { 
        /if n @MyXLoc==$char(x) { 
           /if @MyYLoc==$char(y) { 
              /sendkey up up 
              /return 
           } 
        } 
        /varset MyXLoc $char(x) 
        /varset MyYLoc $char(y) 
        /varset countdown 0 
     } 
     /varadd countdown 1 
     /doevents 
     /if "$char(state)"=="SIT" /stand 
     /face nolook fast loc $calc($target(y)-$cos($target(heading))*10),$calc($target(x)-$sin($target(heading))*10) 
     /if n $distance($calc($target(y)-$cos($target(heading))*10),$calc($target(x)-$sin($target(heading))*10))>1 /goto :gobehindloop 
     /sendkey up up 
     /if "$char(state)"=="SIT" /stand 
     /face fast 
  :noneed 
/return
Sub tankit
/if n @aggrospell==0 {
/call castspell4 
/varset aggrospell 1
}
    /if $char(ability,"Begging")>0 /if n $target(distance)<=15 {
    /attack off
    /doability Begging 
    /attack on
}
/if @mytimer3==0 /if n $char(gem,"Flash of Light")!=-2 /if n $char(mana,pct)>10 /if n $target(distance)<=5 /call castspell3
/return

Sub quickquit
          /if "$target(name,clean)"=="$char(name)" { 
            /echo PAUSING!! To resume, type /target clear or target something else. 
            :HoldingPattern 
               /attack off
               /delay 2s
               /if "$target(name,clean)"=="$char(name)" /goto :HoldingPattern 
      }
          /if $char(state)==DUCK {
          /pet back off
                 /attack off
	         /echo MOB DEAD
	         /sendkey down up
	         /sendkey up up
	         /press esc
            /endmacro keep keys 
                    }
          /if $char(state)==SIT {
          /pet back off
                 /attack off
	         /echo MOB DEAD
	         /sendkey down up
	         /sendkey up up
	         /press esc
            /endmacro keep keys
          }
 /return

Sub announcehp
/if n $target(hp,pct)>75 /varset doonce 0
/if n $target(hp,pct)<74 /if n $target(hp,pct)>50 /varset doonce 0
/if n $target(hp,pct)<49 /if n $target(hp,pct)>25 /varset doonce 0
/if n $target(hp,pct)>10 /if n $target(hp,pct)<9 /varset doonce 0
/if n $target(hp,pct)>5 /if n $target(hp,pct)<4 /varset doonce 0

/if n $target(hp,pct)>=74 /if n $target(hp,pct)<=75 /if n @doonce==0 {
 /if $left(1,"$target(name,clean)")=="#" { 
    /rs $right($calc($strlen("$target(name,clean)")-1),"$target(name,clean)") is at $target(hp,pct) Health 
 } else { 
    /rs $target(name,clean) is at $target(hp,pct) Health 
} 
/varset doonce 1
/return
}
/if n $target(hp,pct)>=49 /if n $target(hp,pct)<=50 /if n @doonce==0 {
 /if $left(1,"$target(name,clean)")=="#" { 
    /rs $right($calc($strlen("$target(name,clean)")-1),"$target(name,clean)") is at $target(hp,pct) Health 
 } else { 
    /rs $target(name,clean) is at $target(hp,pct) Health 
} 
/varset doonce 1
/return
}
/if n $target(hp,pct)>=24 /if n $target(hp,pct)<=25 /if n @doonce==0 {
 /if $left(1,"$target(name,clean)")=="#" { 
    /rs $right($calc($strlen("$target(name,clean)")-1),"$target(name,clean)") is at $target(hp,pct) Health 
 } else { 
    /rs $target(name,clean) is at $target(hp,pct) Health 
} 
/varset doonce 1
/return
}
/if n $target(hp,pct)>=9 /if n $target(hp,pct)<=10 /if n @doonce==0 {
 /if $left(1,"$target(name,clean)")=="#" { 
    /rs $right($calc($strlen("$target(name,clean)")-1),"$target(name,clean)") is at $target(hp,pct) Health 
 } else { 
    /rs $target(name,clean) is at $target(hp,pct) Health 
}
/varset doonce 1
/return
}
/if n $target(hp,pct)>=4 /if n $target(hp,pct)<=5 /if n @doonce==0 {
 /if $left(1,"$target(name,clean)")=="#" { 
    /rs $right($calc($strlen("$target(name,clean)")-1),"$target(name,clean)") is at $target(hp,pct) Health 
 } else { 
    /rs $target(name,clean) is at $target(hp,pct) Health 
}
/varset doonce 1
/return
}
/return

Sub castspells
     /if @mytimer==0 {
     /delay 2
     /face fast
     /sendkey down up
     /sendkey up up
     /if n $char(gem,"Frost Spear")!=-2 /if n $char(mana,pct)>15 /if n $target(hp,pct)>1 /call castspell
        /sendkey up up
     }
      
     /if @mytimer2==0 {
     /delay 2
     /face fast
     /sendkey down up
     /sendkey up up
     /if n $char(gem,"Ice Shard")!=-2 /if n $char(mana,pct)>15 /if n $target(hp,pct)>1 /call castspell2
        /sendkey up up
     }
/return

Sub checkhealth
     /if n $char(pet)>0 /if n $spawn($char(pet),hp,pct)<20 /alt activate 58
     
     /if n $char(hp,pct)<30 /if n $char(mana,pct)<85 {
     /attack off
     /di prot
     /sendkey down up
     /sendkey up up
     /g PARAGON INC
     /delay 2
     /alt activate 128
     /delay 7s
     }
/return
      
Sub castspell
|/echo Frost Spear inc
/doevent flush 
/sendkey up down
/echo CASTING FROST SPEAR!
/call Cast "Frost Spear"
/varset mytimer 31s 
/return

Sub castspell2
|/echo Frost Spear inc 
/doevent flush 
/sendkey up down
/echo CASTING ICE SHARD!
/call Cast "Ice Shard"
/varset mytimer2 34s 
/return

Sub castspell3
|/echo aggro spell inc
/doevent flush 
/sendkey up up 
/delay 5
/echo CASTING FLASH OF LIGHT!
/call Cast "Flash of Light"
/varset mytimer3 8s 
/return

Sub castspell4
|/echo debuff inc
/doevent flush 
/sendkey up up 
/delay 5
/echo CASTING INCAPACITATE!
/call Cast "Incapacitate"
/delay 2s
| /g Debuffing %T
/return

Sub petheal
|/echo Frost Spear inc
/doevent flush 
/alt activate 58
|/sendkey up up 
|/delay 5
|/echo CASTING PET HEAL!
|/call Cast "Healing of Sorsha"
|/delay 2
|/press `
/return


Sub equipavatar 
  /echo Swapping to get Avatar Proc! 
  /autoinv 
  /press i 
  /delay 2 
  /finditem "AVATARWEAPON" 
  /delay 2 
  /click left WEAPONSLOT 
  /autoinv 
  /press i 
  /if "$equip(WEAPONSLOT,name)"!="AVATARWEAPON" { 
     /declare CurrMobID local 
     /varset CurrMobID $target(id) 
     /cleanup 
     /if n @CurrMobID!=0 /target id @CurrMobID 
  } 
/return 

Sub equipnormal 
  /echo Switching back to normal weapon. 
  /autoinv 
  /press i 
  /delay 2 
  /finditem "NORMALWEAPON" 
  /delay 2 
  /click left WEAPONSLOT 
  /autoinv 
  /press i 
  /if "$equip(WEAPONSLOT,name)"!="NORMALWEAPON" { 
     /declare CurrMobID local 
     /varset CurrMobID $target(id) 
     /cleanup 
     /if n @CurrMobID!=0 /target id @CurrMobID 
  } 
/return

Sub Event_Loading 
   /endmacro keep keys 

Sub Event_rageon(OnRageText)
      /if $target()==TRUE { 
   	/echo $target(name,clean) ENRAGED - ATTACK OFF 
	   /call FindEvtNPC "@OnRageText" 200 "has become ENRAGED" 
       /if $return==FOUND { 
           /varset ragevar 1 
           /attack off 
           /pet back off
       } 
   } 
/return
   
Sub Event_rageoff(OffRageText)
   /if $target()==TRUE { 
       /call FindEvtNPC "@OffRageText" 200 "is no longer enraged" 
          /echo $target(name,clean) OFF ENRAGE - ATTACKING
       /if $return==FOUND { 
           /varset ragevar 0 
           /attack on 
           /pet attack
       } 
}   
/return

Sub Event_petrage
   /pet back off
   /call petheal
/return

Sub Event_Enraged
 /echo $target(name,clean) ENRAGED - ATTACK OFF 
 /if $target(name,clean)==$arg(2,"@Param0") { 
                /varset ragevar 1 
                /attack off
                /pet back off
}
/return

Sub Event_asstank 
   /assist "@Param0" 
   /call Combat 
/return

Sub FindEvtNPC(MsgText,SrchRadius,EvtText) 
/declare MobName local 
/declare MobID local 
/declare LastID local 
/declare PositionText local 
/varset PositionText $instr("@EvtText","@MsgText") 
/varset MobName "$mid(0,@PositionText,"@MsgText")" 
/if "$right(1,"@MobName")"==" " /varset MobName "$left($calc($strlen("@MobName")-1),"@MobName")" 
/varset MobID 0 
/varset LastID 0 
/if $target()==TRUE { 
    /varset MobID $searchspawn("@MobName",npc,radius:@SrchRadius) 
    :GetID 
    /if n @MobID!=0 { 
        /varset LastID @MobID 
        /if n $target(id)==@MobID { 
            /return FOUND 
        } else { 
            /varset MobID $searchspawn("@MobName",npc,id:@LastID,radius:@SrchRadius,next) 
            /if n @LastID==@MobID /return NOTFOUND 
            /goto :GetID                      
        } 
    } 
} 
/return NOTFOUND

Sub Event_AEsolro
/doevent flush
/if "$target()"=="TRUE" /if n @aecheck==1 /if n @aevar==0 {
/varset aename "Solar Winds"
/echo AE @aename HAS LANDED!
/varset aetimer 48s
/varset aevar 1
}
/return

Sub Event_AEpowthewise
/doevent flush
/if "$target()"=="TRUE" /if n @aecheck==1 /if n @aevar==0 {
/varset aename "Tidal Freeze"
/echo AE @aename HAS LANDED!
/varset aetimer 60s
/varset aevar 1
}
/return

Sub Event_AEsttjudawos
/doevent flush
/if "$target()"=="TRUE" /if n @aecheck==1 /if n @aevar==0 {
/varset aename "Crumbling Earth Breath"
/echo AE @aename HAS LANDED!
/varset aetimer 18s
/varset aevar 1
}
/return

Sub Event_AEpoearbitor
/doevent flush
/if "$target()"=="TRUE" /if n @aecheck==1 /if n @aevar==0 {
/varset aename "Elemental Judgement"
/echo AE @aename HAS LANDED!
/varset aetimer 36s
/varset aevar 1
}
/return

Sub Event_AEpowofossaa
/doevent flush
/if "$target()"=="TRUE" /if n @aecheck==1 /if n @aevar==0 {
/varset aename "Mists of Enlightenment"
/echo AE @aename HAS LANDED!
/varset aetimer 60s
/varset aevar 1
}
/return

Sub announceae
/if n @aetimer>=8 /if n @aetimer<=10  /if n @aevar==1 {
     /doevent flush
     /echo AE @aename INC IN @aetimer SECONDS!
    | /varset aetimer 0s
     /varset aevar 0
     }
/return

Sub CastSlow
/doevent flush
/echo CASTING SLOW ON $target(name,clean)
/face fast
/attack on
   /varset spellstatus  0
   /varset slowattempts 0
:CastingSlow 
   /if n @slowattempts>=@maxslowattempts { 
      /echo Unable to slow $target(name) after @maxslowattempts tries. 
      /varset spellstatus 1 
      /return } 
    /if n $target(distance)<=200 /call Cast "Sha's Revenge"
    /doevents
    /varadd slowcounter 1
    /if n @slowcounter>=2 {
    /return
    }
   /if n @spellstatus==0 /goto :CastingSlow
   /varset slowcounter 0
/return

Sub Event_SlowResist 
   /varadd slowattempts 1 
/echo $target(name,clean) Resisted Slow
/return 

Sub Event_Slowed
/if n @castslows==1 {
   /varset spellstatus 1 
   /echo $target(name,clean) Slowed
   /if "$target()"=="TRUE" /g >> $target(name,clean) << SLOWED
   }
/return

Sub Slowit
/doevent flush
/echo CASTING SLOW ON $target(name,clean)
/face fast
/attack on
   /varset spellstatus  0
   /varset slowattempts 0
   /if n slowattempts

Sub GoToLoc(xloc,yloc)
   /echo MOVING TO ANCHOR POINT
   /pet back off
      :declare 
      /declare CloseNuff local 
      /declare CharX local 
      /declare CharY local 
       
      :set 
      /varset CloseNuff 3
       
      :startGoToLoc 
      /if n $distance(@xloc,@yloc)<=$calc(@CloseNuff+1) /goto :endGoToLoc 
      /if "$char(state)"!="STAND" /stand 
      /if n $distance(@xloc,@yloc)>=@CloseNuff /sendkey down up 
      /face loc @xloc,@yloc 
       
      :moveGoToLoc
         /doevents
         /delay 0 
         /if n $distance(@xloc,@yloc)<=@CloseNuff /goto :endGoToLoc 
         /face fast loc @xloc,@yloc 
         /if n "@CharX"=="$char(x)" /if n "@CharY"=="$char(y)" /goto :stuckGoToLoc 
         /varset CharX "$char(x)" 
         /varset CharY "$char(y)" 
         /if n $distance(@xloc,@yloc)<=@CloseNuff /goto :endGoToLoc 
         /if n $distance(@xloc,@yloc)>=@CloseNuff /goto :moveGoToLoc 
       
      :stuckGoToLoc 
            /if n $rand(99)>50 /goto :stuckGoLeft 
       
      :stuckGoRight 
         /echo Goin Right 
         /sendkey up up 
         /if n $distance(@xloc,@yloc)>=@CloseNuff /sendkey down up 
         /face heading $calc($char(heading)-120) 
         /if "$char(state)"!="STAND" /stand 
         /delay 5 
         /face loc @xloc,@yloc 
         /goto :moveGoToLoc 
       
      :stuckGoLeft 
         /echo Goin Left 
         /sendkey up up 
         /if n $distance(@xloc,@yloc)>=@CloseNuff /sendkey down up 
         /face heading $calc($char(heading)+120) 
         /delay 5 
         /face loc @xloc,@yloc 
         /if "$char(state)"!="STAND" /stand 
         /goto :moveGoToLoc 
       
      :endGoToLoc 
         /sendkey up up 
         /echo $distance(@xloc,@yloc) from @xloc @yloc 
/return 

Sub SDcheck
   /if "$char(state)"!="STAND" /stand
   /if n $char(gem,"Spiritual Dominion")==0 /memspell 2 "Spiritual Dominion" 
   /delay 3s
   /press ESC 
   /press F1 
   /echo SD INC ON $target(name,clean) 
   /call Cast "Spiritual Dominion"
   /g Inc SD
   :casting_sd 
   /if $char(casting)=="TRUE" { 
      /echo CASTING SD
      /delay 1s
      /goto :casting_sd 
   } 
   /delay 5s
} 
/return

Sub Event_Loading 
/delay 60s
/sit
/delay 5s
/camp
/endmacro
/return 

Sub Event_Slain
/delay 60s
/sit
/delay 5s
/camp
/endmacro
/return

Code: Select all

| spellcast2.inc This is Plazmic's code, slightly edited to support Fsck's LazyRaid.mac
#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 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." 
#event Notarget "You must first select a target for this spell!"
#event Nohold "Your spell did not take hold"

Sub Cast(SpellName) 
  /if n $char(gem,"@SpellName")==0 /return CAST_UNKNOWNSPELL 
  :StartCast
         /if $char(state)==DUCK {
            /pet back off
            /endmacro
            }
            /if $char(state)==SIT {
            /pet back off
            /endmacro
          }
  /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 NoLOS 
     /doevents Resisted 
     /if "$return"=="CAST_RESTART" /goto :StartCast 
     /if "$return"!="CAST_SUCCESS" /return "$return" 
/return CAST_SUCCESS 

Sub Event_Notarget
/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_OutOfRange 
/return CAST_OUTOFRANGE 

Sub Event_NoLOS 
/return CAST_CANNOTSEE 

Sub Event_Stunned 
/return CAST_STUNNED 

Sub Event_Resisted 
/return CAST_RESISTED

Sub Event_Nohold
/return CAST_SUCCESS