Ranger Autopull and Auto Archer

Post your completed (working) macros here. Only for macros using MQ2Data syntax!

Moderator: MacroQuest Developers

nbjeter3
a lesser mummy
a lesser mummy
Posts: 39
Joined: Wed Jan 21, 2004 12:18 am

Ranger Autopull and Auto Archer

Post by nbjeter3 » Thu Aug 05, 2004 7:18 pm

This is a fixed version of the Rangerautopull.mac modded to also use the Ranger aurofire w/snare Macro as well. The Basic function of the macro is to target the nearest NPC within a range of 500, Run out to within 175 of it, casts ensnare, runs back to anchor point and pauses 7 seconds while tank grabs aggro. After that 7 seconds, it assists the mob (Hopefully tank can grab aggro by then) Which then targets the tank, and starts the autoarcher with the autoassistonattack and snare parameters and starts autofiring on the mob.. It Will also melee the mob if it gets too close to range fight it. *****IMPORTANT***** Make Sure To Park The Ranger well behind the tank before you start the macro. It Creates its anchor point on the initial posistion. This will Only work from within the group. If Ranger does not get Exp. He will not restart the cycle. There is one thing I would like help on if anyone can help me out. I want to add in a section on the pulling part that checks for other mobs nearby and Harmonies them. If anyone knows how I can achieve this please by all means add it in.

Credits go out to:
Omper as I used his code and fixed it to work for the pulling section
Loadingpleasewait and Kasodo For The Autoarcher section
and the makers of Genbot whom I nabbed a few lines of code from to combine the two and streamline the code a bit.
Big props go out To My Ranger And Tank Buddies Who, at risk of Life and limb and Exp, Tested it Out for Me!
****Disclaimer**** This is my first attempt at something Complicated like this so it may still be a lil buggy. Lemme know how it works for you.

now Onto the good stuff the CODE!

Code: Select all

|  Rangerautopull.mac   v1.0 
|Uses Files Spellcast.inc, and Arch.inc
|Usage: /mac rangerautopull     Park Ranger behind The tank, Start Macro And Enjoy! Tank has 7 Seconds To Get Aggro 
|Once You Get back To Your anchor point! Otherwise You Will Assist On Yourself And Send it into an Endloess
|Loop of "You cannot assist on Yourself!"
|Originally Writen by Omper, fixed and modded by nbjeter3

#chat tell 
#include spellcast.inc 
#include Arch.inc
#event GotHIT "Hit You For" 

 

Sub Main 

/declare AnchorLoc string outer 0
/declare FLoc string outer 0
/declare GoToLoc string outer 0
/declare startpoint int outer 
      
   /echo Rangerautopull.mac 
    
   /varset AnchorLoc ${Me.Y},${Me.X}
        /cleanup 
        /doevents 
        /call MoveToAnchor 
        /delay 10            
   /call Tarnpc 
    
/return 


Sub Tarnpc    

   /target npc radius 500
   /face
   /call MoveToTarget
   /call Cast "Ensnare"      
   /call MoveToanchor
   /delay 100
   /assist
   /delay 20
   /call Archer Snare Autoassist
   /call Main
/return 



Sub Event_GOTHIT 
    
   /call MoveToAnchor 
   :Loop 
      /if (${Target.Distance}>20) { 
            /keypress forward    
            } 
            /if (${Target.Distance}<10) { 
            /keypress back hold 
            /timed 1 /keypress back 
            } 
            /face nolook fast 
            /delay 0 
         /if (!${Target.ID}) { 
            /goto :End 
            } else { 
         /goto :Loop 
         } 

:End 
          /call MoveToAnchor 
/return 

Sub MoveToAnchor 
    /declare iCount int local 

    /varset FLoc ${Me.Y},${Me.X}
    /varset iCount 0 

    /echo Moving to Anchor at Loc: ${AnchorLoc}. 

:AnchorMoveLoop  
    /delay 1 
    /doevents 
    /face nolook loc ${AnchorLoc} 
    
    /if (${Math.Distance[${AnchorLoc}]}>12) { 
       /keypress forward hold 
   } else { 
       /keypress forward 
        /return 
    } 

    /if (${iCount}>2) { 
        /call Detectobst 
        /face nolook loc ${AnchorLoc} 
        /varset iCount 0 
    } 
    
    /varcalc iCount ${iCount}+1 
    /goto :AnchorMoveLoop 
/return 

Sub MoveToTarget 
    /declare iCount int local 

|    /varset GoToLoc ${Me.Y},${Me.X}
|    /varset iCount 0 

    /echo Moving to mob, Hope I Don't Die. 
    
:TargetMoveLoop  
/delay 1 
    /doevents 
    /face 
    
    /if (${Target.Distance}>175) { 
       /keypress forward hold 
   } else { 
       /keypress forward 
        /return 
    } 

    /if (${iCount}>2) { 
        /call Detectobst 
        /face 
        /varset iCount 0 
    } 
    
    /varcalc iCount ${iCount}+1 
    /goto :TargetMoveLoop 
/return 

Sub Detectobst 
    /delay 2 
|    /if (${FLoc}==${Me.Y},${Me.X}) /call Hitobst 
|    /varset FLoc ${Me.Y},${Me.X} 
/return 

Sub Hitobst 
    /keypress forward 
    /keypress back hold 
    
    /if (${Math.Rand[2]}) {    
        /delay 2s    
        /keypress back 
        /keypress right hold 
        /delay 8 
        /keypress right 
        
        /delay 2s 
        /keypress back 
        /keypress left hold 
        /delay 8 
        /keypress left 
    } 
    /delay 10 
    /keypress forward hold 
/return 
Don't hate Me cuz I'm beautiful.. I Can give you MUCH better reasons Than That....

Noone Likes A necro... till Mid-battle And They're OOM..

nbjeter3
a lesser mummy
a lesser mummy
Posts: 39
Joined: Wed Jan 21, 2004 12:18 am

arch.inc

Post by nbjeter3 » Thu Aug 05, 2004 7:22 pm

Code: Select all

|** 
 arch.inc Auto-Archery 

 ABOUT: 
 just run this macro, target a mob, and turn on auto attack 
 The macro will detect autoattack, turn it back off, and begin firing arrows 
 or as I do, just /assist your MA =P 
  
 In some situations, you know what I'm talking about, you need to melee.. 
 No Problem!  this macro will auto melee also! When in close range to the target 
 the macro automatically turns on autoattack, it auto kicks, and auto disarms. 
 then just step back out of range and it will start firing arrows again!!! 
 Auto taunt now added as a toggle.  

 Added auto-reroot, good for soloing when root breaks. it does NOT auto root, 
 it just re roots your already rooted target.(wouldnt want it to auto root, 
 as it would root your target at its spawn location) 

 the macro will recast self haste of "eyepatch of plunder"     CHANGE THIS 
 the macro will recast the spell "Eagle Eye"                  CHANGE THIS 
 REQUIREMENT Spellcast.inc for reliable spell casting which can be found here: 
 http://macroquest2.com/phpBB2/viewtopic.php?t=6748 
  
 It will display the experience gain as an echo and popup. 
  
 HISTORY: 
  
 June 19, 2004 Fixxed to work with June 19th zip. Basically set all variables to 0 as it appears they no 
 longer default to 0.  ADDED auto-assist toggle.  I've had this in my own version for a while, I was just 
 to lazy to add it to the site. Basically, you target who you want to assist and start the macro. It MUST 
 be a Player Character, if it is not, then the macro will end. The macro will now auto assist when the assist's 
 Target is an NPC and within assistdistance, which is defaulted to 60. You may change the assistdistance at 
 any time using the /varset assistdistance ### command. (replace ### with the distance you want to use. duh!) 
 This will NOT follow your target, it will just let you stand, or sit, where you want and stand ya up when 
 your target is near and begin firing arrows, or meleeing if the target is in range. Enjoy!  = ) 

 May 25, 2004 Modified by loadingpleasewait to add a toggle for arch.mac not to use archery?!? go figure.. 
 but its done.. use "noarch" as the toggle argument. 
  
 May 24, 2004 Modified by loadingpleasewait Added verbose toggle to announce snares and immune messages 
 to group. Added distance check for auto-snare cast.  Added .ini support to the autoforage, filename 
 ArchForage.ini. Added check to see if you were sitting before forage, if you are, it will stand forage 
 then sit again, if your not sitting, it will just continue standing. Fixed it so it will no longer 
 assume that you have a 200 skill in forage. 
  
 May 21, 2004 Modified by loadingpleasewait more bugs swatted, added check for mobs immune to snare 
 so the macro doesnt keep trying to cast on the mob, over and over and over and over and over... etc.. 
 fixxed the forage looping issue when you would have to wait longer to forage..  

 May 18,2004 Modified by loadingpleasewait added an autotaunt when within closecombat 
 also added root toggle to toggle weather or not to ReRoot your target 
  
 May 17, 2004 Modified by loadingpleasewait to swat bugs, make automelee 
 work automatically, make the autosnare a toggle and all around make it better :) 
  
 May 5, 2004 Modified by Kasodo  updated to MQ2Data /MQ2Datavars Autosnare at 70% 
  
 UNKNOWN DATE Created by loadingpleasewait  
  
 USAGE: 
 /mac arch <forage|snare|taunt|root|verbose|noarch|autoassist>  
 Use all, or none, in any order seperated by spaces to do specified action 
**| 

#include spellcast.inc 
#turbo 40 
#Event exp "#*#experience!#*#" 
#Event haste "#*#The quickening spirit departs#*#" 
#Event eagle "#*#The avian presence departs#*#" 
#Event resist "Your target resisted the Ensnare spell#*#" 
#Event resist "Your Ensnare spell has worn off#*#" 
#Event Snaresuccess "#*#has been ensnared#*#" 
#Event Immune "#*#changes in its run speed#*#" 
#Event reroot "Your Earthen Roots spell has worn off#*#" 
#Event reroot "Your target resisted the Earthen Roots spell#*#" 
#Event Casting "#*#You begin casting#*#" 
#Event waitforage "#*#before you can forage#*#" 

Sub Archer 
/assist on 
   /echo "Auto-Arch Macro has begun." 
   /declare i int local 
   /declare autoassist outer 0 
   /declare tankname outer 0 
   /declare assistdistance outer 60 
   /declare noarch outer 0 
   /declare verbose outer 0 
   /declare foragetoggle outer 0 
   /declare waitforage outer 0 
   /declare invset outer 0 
   /declare notset outer 0 
   /declare sitstatus outer 0 
   /declare snaretoggle outer 0 
   /declare taunttoggle outer 0 
   /declare roottoggle outer 0 
   /declare needsnare outer 0 
   /declare immunetosnare outer 0 
   /declare startexp outer 0 
   /declare startaaxp outer 0 
   /declare currentxp outer 0 
   /declare xpgain outer 0 
   /declare currentaa outer 0 
   /declare aagain outer 0 
   /declare targetarray[4] string outer 

   /varset startexp ${Me.PctExp} 
   /varset startaaxp ${Me.PctAAExp} 
   /varset autoassist 1

/for i 0 to 6 
  /if (${Defined[Param${i}]}) { 
     /if (${Param${i}.Equal[snare]}) { 
         /echo "Auto-Snare enabled" 
         /varset snaretoggle 1 
         /varset needsnare 1 
         /varset immunetosnare 0 
         } 
      /if (${Param${i}.Equal[taunt]}) { 
         /echo "Auto-Taunt enabled" 
         /varset taunttoggle 1 
         } 
      /if (${Param${i}.Equal[forage]}) { 
         /echo "Auto-Forage enabled" 
         /varset foragetoggle 1 
         /varset waitforage 0 
         /varset sitstatus 0 
         /varset notset -1 
         } 
      /if (${Param${i}.Equal[root]}) { 
         /echo "Auto-ReRoot enabled" 
         /varset roottoggle 1 
         } 
      /if (${Param${i}.Equal[verbose]}) { 
         /echo "Group Anounce enabled" 
         /varset verbose 1 
         } 
      /if (${Param${i}.Equal[noarch]}) { 
         /echo "Auto-Arch macro will not Auto-Arch.. go figure?!?" 
         /varset noarch 1 
         } 
      /if (${Param${i}.Equal[autoassist]}) { 
         /echo "Auto-Assist enabled" 
         /varset autoassist 1 
         /if (!${Target.ID} || ${Target.Type.NotEqual[PC]}) { 
            /echo You need to target your assist, and make sure its a player character! 
            /endmacro 
         } else { 
         /varset tankname ${Target.CleanName} 
         /echo Assist set to ${tankname} 
         /assist on 
            } 
         } 
   } 
/next i 

:mainloop 
/if (${autoassist}==1) { 
   /assist ${tankname} 
   /if (${Target.Type.NotEqual[PC]} && ${Target.Distance}<${assistdistance}) { 
         /if (${Me.Sitting}) { 
      /stand 
      /varset sitstatus 1 
   } 
      /attack on 
} 
   /delay 5 
} 
   /if (${Me.Combat} && ${Target.ID} && ${Target.CleanName.NotEqual[${Me.Name}]}) /call Archery 
         /if (${foragetoggle}==1 && ${Me.AbilityReady[Forage]}) /call forage 
        /doevents 
      /goto :mainloop 
/return 

Sub Archery 
  /attack off 
  /varset targetarray[1] ${Target.CleanName} 
  /varset targetarray[2] ${Target.Level} 
  /varset targetarray[3] ${Target.Name} 
  /varset targetarray[4] ${Target.ID} 
    
   /echo Fighting a ${targetarray[2]} ${targetarray[1]} 
  /face nolook 
  :CloserAF    
  /if (${Me.Combat}) /attack off 
/if (${Target.Distance}>30 && ${Me.RangedReady} && ${noarch}!=1) /ranged 
         /if (${foragetoggle}==1 && ${Me.AbilityReady[Forage]}) /call forage 
/if (${snaretoggle}==1 && ${needsnare}==1 && ${Target.PctHPs}<40 && ${Target.Distance}<150) { 
         /call Cast "Ensnare" gem4 
         /varset needsnare 0 
         /doevents 
         /if (${verbose}==1 && ${immunetosnare}==0 && ${needsnare}==0) /gsay %t has successfully been snared 
      } 
    /if (${snaretoggle}==1 && ${needsnare}==1 && ${Target.PctHPs}<40 && ${Target.Distance}>150) { 
      /popup "Too Far Away For Auto-Snare, GET CLOSER!!" 
      /delay 2 
   } 
    /doevents 
    /if (${Target.Distance}<25) /call closecombat 
    /if (${Target.ID}!=${targetarray[4]}) /goto :EndAF 
    /doevents 
    /if (!${Target.ID}) /goto :EndAF 
     /doevents 
    /goto :CloserAF 
:EndAF 
    /echo a ${targetarray[2]} ${targetarray[1]} is dead 
    /if (${snaretoggle}==1) { 
      /varset needsnare 1 
      /varset immunetosnare 0 
   } 
    /keypress Num_5 
       /if (${sitstatus}==1) { 
      /sit 
      /varset sitstatus 0 
   } 
/return 

Sub closecombat 
   /attack on 
   :stillclose 
            /if (${foragetoggle}==1 && ${Me.AbilityReady[Forage]}) { 
               /attack off 
               /delay 5 
            /call forage 
            /attack on 
         } 
      /if (${Target.Distance}<11 && ${Me.AbilityReady["Disarm"]}) /doability "Disarm" 
      /if (${Target.Distance}<11 && ${Me.AbilityReady["Kick"]}) /doability "Kick" 
      /if (${taunttoggle}==1 && ${Target.Distance}<11 && ${Me.AbilityReady["Taunt"]}) /doability "Taunt" 
      /doevents 
      /if (${snaretoggle}==1 && ${needsnare}==1 && ${Target.PctHPs}<40 && ${Target.Distance}<150) { 
         /call Cast "Ensnare" gem4 
         /varset needsnare 0 
         /doevents 
         /if (${verbose}==1 && ${immunetosnare}==0 && ${needsnare}==0) /gsay %t has successfully been snared 
      } 
    /if (${snaretoggle}==1 && ${needsnare}==1 && ${Target.PctHPs}<40 && ${Target.Distance}>150) { 
      /popup "Too Far Away For Auto-Snare, GET CLOSER!!" 
      /delay 2 
   } 
    /if (${Target.Distance}<25 && ${Target.ID} && ${Target.ID}==${targetarray[4]} && ${Target.CleanName.NotEqual[${Me.Name}]}) /goto :stillclose 
    /attack off 
   /return 

Sub Event_exp 
   /varset currentxp ${Me.PctExp} 
   /varset xpgain ${Math.Calc[${currentxp}-${startexp}]} 
   /varset currentaa ${Me.PctAAExp} 
   /varset aagain ${Math.Calc[${currentaa}-${startaaxp}]} 
      /popup "Gain: ${xpgain}% xp - ${aagain}% aa ## Cur: ${Me.PctExp}% xp - ${Me.PctAAExp}% aa" 
      /echo "Gain: ${xpgain}% xp - ${aagain}% aa ## Cur: ${Me.PctExp}% xp - ${Me.PctAAExp}% aa" 
   /varset startexp ${Me.PctExp} 
   /varset startaaxp ${Me.PctAAExp}
   /call TarNPC 
/return 

Sub event_eagle 
   /if (${Me.Sitting}) { 
      /stand 
      /varset sitstatus 1 
   } 
      /call Cast "Eagle Eye" gem6 
   /if (${sitstatus}==1) { 
      /sit 
      /varset sitstatus 0 
   } 
/return 

Sub event_haste 
   /if (${Me.Sitting}) { 
      /stand 
      /varset sitstatus 1 
   } 
      /call Cast "Eyepatch of Plunder" item 
   /if (${sitstatus}==1) { 
      /sit 
      /varset sitstatus 0 
   } 
/return    

Sub event_reroot 
      /if (${roottoggle}==1) { 
         /target npc id ${targetarray[4]} 
         /call Cast "Earthen Roots" gem2 
      } 
/return 

Sub Event_resist 
/doevents 
   /if (${snaretoggle}==1 && ${immunetosnare}==0) /varset needsnare 1 
      /return 

Sub Event_Immune 
   /if (${snaretoggle}==1) { 
      /varset needsnare 0 
      /varset immunetosnare 1 
      /if (${verbose}==1) /gsay %t is Immune to snare 
   } 
/return 

sub Event_Casting 
   :checkcast 
    /delay 1 
    /if (${Me.Casting.ID}) /goto :checkcast 
/return 

sub forage 
   /if (${Me.Sitting}) { 
      /stand 
      /varset sitstatus 1 
   } 
   /if (${Me.Ducking}) /stand 
:waitforage 
   /doability Forage 
   /delay 1 
   /doevents 
   /if (!${Cursor.ID} && ${waitforage}==0 && ${Me.Skill["Forage"]}==200) /goto :waitforage 
   /varset waitforage 0 
   /call destroyornot 
   /if (${sitstatus}==1) { 
      /sit 
      /varset sitstatus 0 
   } 
/return 

sub Event_waitforage 
   /if (${foragetoggle}==1) /varset waitforage 1 
/return 

sub destroyornot 
   /varset invset ${Ini[ArchForage.ini,ForageList,${Cursor.Name},${notset}]} 
   /delay 3 
   /if (${invset}==${notset}) { 
      /ini "ArchForage.ini" "ForageList" "${Cursor.Name}" "1" 
      /varset invset 1 
      } 
   /if (${invset}==1) { 
      /echo Found ${Math.Calc[${FindItemCount[${Cursor.Name}]}+1].Int} ${Cursor.Name}'s so far! 
      /popup Found ${Math.Calc[${FindItemCount[${Cursor.Name}]}+1].Int} ${Cursor.Name}'s so far! 
      :Keep 
      /autoinv 
      /delay 3 
      /if (${Cursor.ID}) /goto :Keep 
      } else { 
      /popup "${Cursor.Name} Destroyed!" 
      /destroy 
      } 
/return[quote][/quote]
Don't hate Me cuz I'm beautiful.. I Can give you MUCH better reasons Than That....

Noone Likes A necro... till Mid-battle And They're OOM..

nbjeter3
a lesser mummy
a lesser mummy
Posts: 39
Joined: Wed Jan 21, 2004 12:18 am

ok not Sure WHY it threw in The quote on the end

Post by nbjeter3 » Thu Aug 05, 2004 7:23 pm

Not Sure Why it threw the quotes on the end.. do not include That please..
Don't hate Me cuz I'm beautiful.. I Can give you MUCH better reasons Than That....

Noone Likes A necro... till Mid-battle And They're OOM..

nbjeter3
a lesser mummy
a lesser mummy
Posts: 39
Joined: Wed Jan 21, 2004 12:18 am

spellcast.inc

Post by nbjeter3 » Thu Aug 05, 2004 7:25 pm

Code: Select all

| 
| SpellCast.inc 
| 
| Last Modified: 5/14/2004 9:30pm 
| This will cast a spell reliably for you... 
| 
| Usage: 
|       /call Cast "spellname|itemname|AA#|AAskillname" [item|activate|gem#] [nocheck|dismount|nodismount] 
| 
| If no dismount or nodismount is provided it defaults to nodismount. 
| 
| This would essentially: /cast "Death Peace" 
| example: /call Cast "Death Peace" 
| 
| This would essentially: Check for the spell in your spell slots, if not there mem it to spell 
|                         gem slot 7 and then /cast "Death Peace" 
| example: /call Cast "Death Peace" gem7 
| 
| This would essentially: /cast item "White Rope Bridle" 
| example: /call Cast "White Rope Bridle" item 
| 
| This would essentially: /alt activate 169 
| example: /call Cast "169" activate 
|  or... 
| example: /call Cast "Divine Arbitration" activate 
| 
| This would dismount if your target was lost or dies mid-cast, cast Burn and mem it to spell 
| slot 3 if it wasn't already memmed: 
| example: /call Cast "Burn" gem3 dismount 
| 
| This would not dismount but would move you back and forth if your target was lost or dies mid-cast, cast Burn and mem 
| it to spell slot 3 if it wasn't already memmed: 
| example: /call Cast "Burn" gem3 nodismount 
| 
| 'nocheck' is the default for the "loss of target/target dying" value.  If nocheck is specified (Or nothing was specified) 
| no target checking will be performed and spellcast.inc should act like the spellcast.inc of the past. 
| 
| It will return the following values: 
| CAST_SUCCESS 
| CAST_UNKNOWNSPELL 
| CAST_OUTOFMANA 
| CAST_OUTOFRANGE 
| CAST_CANNOTSEE 
| CAST_STUNNED 
| CAST_RESISTED 
| CAST_TOOK2LONG 
| CAST_ABILITYNOTREADY 
| CAST_IMMUNESLOW 
| CAST_LOSTTARGET 
| 
| New Vars Modification 
| Plazmic's no globals needed version 
| 
| Oct 09, 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 
| XXX xx, xxxx - Modified to add automeming of spells. -Goofmester1 
| Dec 26, 2003 - fd fail 1 added -m0nk 
| Jan 01, 2004 - timeout(5s) added to stop "dead-time" -m0nk 
| Jan 01, 2004 - switchd fdfail to a standing check. -m0nk 
| Jan 01, 2004 - added silence checking as a stun check -m0nk 
| Feb 17, 2004 - added AA activate capabilities -ml2517 
| Apr 11, 2004 - Updated for new Parm system -ml2517 
| Apr 12, 2004 - Will spit out a different message on immune to slows. -ml2517 
| Apr 16, 2004 - Removed /sendkeys and replaced with /keypress. -ml2517 
| Apr 17, 2004 - Various code enhancements. -Wassup 
| Apr 20, 2004 - Updated all of the /if's to have parenthesis. -ml2517 
| Apr 25, 2004 - Updated to new variable system. -ml2517 
| Apr 29, 2004 - Fixed Item problem -ml2517 
| Apr 29, 2004 - Changed the alt ability to use AltAbilityReady instead of an event. -ml2517 
| May 02, 2004 - Added the ability to specify a gem slot to mem spells to. -ml2517 
| May 10, 2004 - Updated for new event system. 
| May 12, 2004 - Added suggestions for loss of target and stun handling change. -ml2517 
| May 13, 2004 - Activate now accepts AA skill by name or number. -ml2517 
| May 14, 2004 - Added the nocheck value, it is the default. This bypasses the target checking code. -ml2517 
| 

#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 "#*#Your 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 Stunned "#*#You *CANNOT* cast spells, you have been silenced!#*#" 
#event Standing "#*#You must be standing to cast a spell#*#" 
#event Standing "#*#has fallen to the ground.#*#" 
#event Collapse "#*#Your gate is too unstable, and collapses.#*#" 
#event ImmuneSlow "#*#Your target is immune to changes in its attack speed.#*#" 


Sub Cast(SpellName,ItemFlag,DismountFlag) 
   /declare HaveTarget int local 0 
   /declare CastBarTime timer local 
   /declare CastCurrLocY float local 0 
   /declare CastCurrLocX float local 0 
   /varset CastCurrLocY ${Me.Y} 
   /varset CastCurrLocX ${Me.X} 
   /if (${Target.ID}>0) /varset HaveTarget 1 
   /if (!${Defined[CastGiveUpTime]}) /declare CastGiveUpTime timer local 
   /if (!${Defined[ItemFlag]}) /declare ItemFlag string local 
   /if (!${Defined[DismountFlag]}) { 
       /declare DismountFlag string local nocheck 
       /if (${ItemFlag.Find["dismount"]}) /varset DismountFlag ${ItemFlag} 
   } 
   /if (!${Me.Standing} && !${Me.Mount.ID}>0) /stand 
   /if (${Me.Moving}) { 
       /keypress forward 
       /keypress back 
       /delay 8 
   } else { 
       /delay 4 
   } 
   /if (${ItemFlag.Equal["Item"]} || ${ItemFlag.Equal["Activate"]}) /goto :StartCast 

   /if (!${Me.Gem["${SpellName}"]}) { 
       /if (${ItemFlag.Find[gem]}) { 
           /if (${Int[${ItemFlag.Right[1]}]}>0 && ${Int[${ItemFlag.Right[1]}]}<9) { 
               /memspell ${ItemFlag.Right[1]} "${SpellName}" 
               /delay 5s 
           } else { 
               /goto :GenericMem 
           } 
       } else {        
           :GenericMem 
           /memspell 5 "${SpellName}" 
           /delay 5s 
       } 

   } 
   :StartCast 
      /varset CastGiveUpTime 5s 
   :CastNow 
      /if (${ItemFlag.Equal["Item"]}) { 
         /call ClearReturnValue 
         /cast item "${SpellName}" 
      } else /if (${ItemFlag.Equal["Activate"]}) { 
         /call ClearReturnValue 
         /if (!${Me.AltAbilityReady[${SpellName}]}) /return CAST_ABILITYNOTREADY 
         /alt activate ${AltAbility[${SpellName}].ID} 
         /varset CastBarTime ${Me.Casting.CastTime} 
      } else { 
         /if (!${Me.Gem["${SpellName}"]}) /return CAST_UNKNOWNSPELL 
         /call ClearReturnValue 
         /if (!${Me.SpellReady["${SpellName}"]}) { 
            /if (${CastGiveUpTime}==0) /return CAST_TOOK2LONG 
            /delay 1 
            /goto :CastNow 
         } 
         /cast "${SpellName}" 
         /varset CastBarTime ${Math.Calc[${Me.Casting.CastTime}*10]} 
      } 
   :WaitCast 
      /if (${Me.Casting.ID}) { 
         /if ((!${Target.ID}>0 || ${Target.Type.Equal[CORPSE]}) && !${DismountFlag.Find[nocheck]} && ${HaveTarget}==1) { 
             /if (${Me.Mount.ID}>0) { 
                 /if (${DismountFlag.Equal[dismount]}) { 
                     /dismount 
                 } else { 
                     /if (!${ItemFlag.Equal["Item"]}) { 
                         /if (${CastBarTime}<7) { 
                             :Interrupt 
                             /keypress FORWARD hold 
                             /delay 6 
                             /keypress FORWARD 
                             /keypress BACK hold 
                             /delay 8 
                             /keypress BACK 
                         } else { 
                             :HoldForSpell 
                             /delay 1 
                             /if (${CastBarTime}<7) /goto :Interrupt 
                             /goto :HoldForSpell 
                         } 
                     } else { 
                         /keypress FORWARD hold 
                         :Forward 
                         /delay 1 
                         /if (${Math.Distance[${CastCurrLocY},${CastCurrLocX}]}<6) /goto :Forward 
                         /keypress FORWARD 
                         /keypress BACK hold 
                         :Backward 
                         /delay 1 
                         /if (${Math.Distance[${CastCurrLocY},${CastCurrLocX}]}>4) /goto :Backward 
                         /keypress BACK 
                         /if (!${Me.Casting.ID}>0) /goto :DuckTime 
                     } 
                 } 
             } 
             :DuckTime 
             /keypress FORWARD 
             /keypress BACK 
             /if (!${Me.Ducking}) /keypress DUCK 
             /delay 1 
             /if (${Me.Ducking}) /keypress DUCK 
             /return CAST_LOSTTARGET 
         } 
         /delay 1 
         /goto :WaitCast 
      } 
   /delay 1 
   /doevents Fizzle 
   /doevents Interrupt 
   /doevents Interrupt 
   /doevents Recover 
   /doevents Standing 
   /doevents OutOfRange 
   /doevents OutOfMana 
   /doevents NoLOS 
   /doevents Resisted 
   /doevents ImmuneSlow 
   /doevents Stunned 
   /doevents Collapse 
   /if (${Macro.Return.Equal["CAST_RESTART"]}) /goto :StartCast 
   /if (!${Macro.Return.Equal["NULL"]}) /return ${Macro.Return} 
/return CAST_SUCCESS 

Sub ClearReturnValue 
/return NULL 

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 
   /delay 2s !${Me.Stunned} 
/return CAST_RESTART 

Sub Event_Resisted 
/return CAST_RESISTED 

Sub Event_ImmuneSlow 
/return CAST_IMMUNESLOW
Don't hate Me cuz I'm beautiful.. I Can give you MUCH better reasons Than That....

Noone Likes A necro... till Mid-battle And They're OOM..

omper
a ghoul
a ghoul
Posts: 110
Joined: Sat Dec 06, 2003 10:46 pm

Post by omper » Sat Aug 07, 2004 8:51 pm

Thanks for putting me in the credits.. ( BOW ) .. i wrote this so long ago and was one of the first that wrote. I love what you have done with it..

Again thanks

Omper