What a Ranger needs. auto archery / forage / snare / taunt.

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

Moderator: MacroQuest Developers

zanlez
orc pawn
orc pawn
Posts: 10
Joined: Thu Sep 16, 2004 8:58 am

What a Ranger needs. auto archery / forage / snare / taunt.

Post by zanlez » Fri Sep 17, 2004 11:48 pm

Been working on the auto archery stuff that is already out there. And solved some of the buggs i got when i ran em and uppgraded them some more. Take a look and give me feed back please.

Code: Select all

|**arch.mac Auto-Archery 
|Just run this macro, and it will assist the puller and wait till it is in range and at the proper hp to engage. I suggest to put the ranger in a safe corner. for example in poearth, I use the corners in the zone in, or maybe even ontop of the zone to pot and earthb **| 
| 
|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. 
| 
|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 
| 
|It will display the experience gain as an echo and popup. 
| 
| Created by loadingpleasewait on UNKNOWN DATE 
| Modified by Kasodo May 5, 2004 updated to MQ2Data /MQ2Datavars 
| Autosnare at 70% 
| Modified by loadingpleasewait on May 17, 2004 to swat bugs, make automelee 
| work automatically, make the autosnare a toggle and all around make it better  
| Modified by loadingpleasewait on May 18,2004 to add an autotaunt when within closecombat 
| 
| usage: 
| 
| /mac arch Forage               enter forage if you want to auto forage 
| /mac arch Taunt                enter taunt to autotaunt when in melee distance 
| /mac arch Snare                enter snare if you want to snare at 70% 
| /mac arch Snare Forage         enter snare then forage to snare and forage, but not taunt 
| /mac arch Taunt Forage         enter taunt then forage to taunt and forage, but not snare 
| /mac arch Snare Taunt          enter snare then taunt to snare and taunt, but not forage 
| /mac arch Snare Taunt Forage   enter snare, taunt, then forage for it to do all 3 
| 


#include spellcast.inc 
#turbo 40 
#Event exp "#*#experience!#*#" 
#event haste "#*#The quickening spirit departs#*#" 
#event eagle "#*#The avian presence departs#*#" 
#event cop "#*#The predator's spirit departs#*#"
#event sot "#*#Tunare's strength ebbs#*#"
#Event resist "Your target resisted the Ensnare spell#*#" 
#Event resist "Your Ensnare spell has worn off." 
#Chat group 



Sub Main 
   /echo "Auto-Arch Macro has begun." 
   /declare foragetoggle outer 
   /declare snaretoggle outer 
   /declare taunttoggle outer 
   /declare needsnare outer 
   /declare startexp outer 
   /declare startaaxp outer 
   /declare currentxp outer 
   /declare xpgain outer 
   /declare currentaa outer 
   /declare aagain outer 
   /declare targetarray[4] string outer 
   /declare combat outer
   /declare mobname outer

   /Varset foragetoggle 0
   /varset snaretoggle 0
   /varset taunttoggle 0

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

/if (${Defined[Param0]} && ${String[${Param0}].Equal[snare]}) { 
   /echo "Auto-Snare enabled" 
   /varset snaretoggle 1 
   /varset needsnare 1 
   } 
/if (${Defined[Param0]} && ${String[${Param0}].Equal[taunt]}) { 
   /echo "Auto-Taunt enabled" 
   /varset taunttoggle 1 
   } 
/if (${Defined[Param1]} && ${String[${Param1}].Equal[taunt]}) { 
   /echo "Auto-Taunt enabled" 
   /varset taunttoggle 1 
   } 
/if (${Defined[Param0]} && ${String[${Param0}].Equal[forage]}) { 
   /echo "Auto-Forage enabled" 
   /varset foragetoggle 1 
   } 
/if (${Defined[Param1]} && ${String[${Param1}].Equal[forage]}) { 
   /echo "Auto-Forage enabled" 
   /varset foragetoggle 1 
   } 
/if (${Defined[Param2]} && ${String[${Param2}].Equal[forage]}) { 
   /echo "Auto-Forage enabled" 
   /varset foragetoggle 1 
   } 

	:mainloop

	  /if (${foragetoggle}==1 && ${Me.AbilityReady["Forage"]}) { 
            /doability Forage 
            /delay 20 
            /if (${Cursor.ID}) /autoinv 
	    }

	/doevents
/goto :mainloop

/return
       
Sub Event_Chat(string ChatType, string Sender, string ChatText) 

   /if (${ChatText.Find[sow]})  {
	/target ${Sender}
	/call Cast "Spirit of Wolf"
	/if (${combat}==1) {
		/target ${mobname}
		/call archery
		}
	}
    
   /if (${ChatText.Find[inc]} && ${Target.Distance}>150) /goto :mainloop 
   /if (${ChatText.Find[inc]}) { 
   /echo Assisting ${Sender}
   /assist ${Sender}
   /delay 1s
   /varset mobname ${Target.CleanName}
   /varset combat 1
   /call archery
   } 
  


   /if (${Me.Combat} && ${Target.ID} && ${Target.CleanName.NotEqual[${Me.Name}]}) /call Archery 
         /if (${foragetoggle}==1 && ${Me.AbilityReady[Forage]}) { 
            /doability Forage 
            /delay 20 
            /if (${Cursor.ID}) /autoinv 
         } 
        /doevents 
     
/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 lvl ${targetarray[2]} ${targetarray[1]} 
  /face nolook 
  :CloserAF  

  /if (${Me.Combat}) /attack off 
  /if (${Target.Distance}>20 && ${Me.RangedReady} && ${Target.PctHPs}<95) /ranged 
 
/if (${snaretoggle}==1 && ${needsnare}==1 && ${Target.PctHPs}<70) { 
      /call Cast "Ensnare" 
      /varset needsnare 0 
     }  
    /doevents 
    /if (${Target.Distance}<20) /call closecombat 

    /if (${Target.ID}!=${targetarray[4]}) /goto :EndAF 
    /doevents 
    /if (!${Target.ID}) /goto :EndAF 
     /doevents 
    /goto :CloserAF 
:EndAF 
    /echo a lvl ${targetarray[2]} ${targetarray[1]} is dead 
    /if (${snaretoggle}==1) /varset needsnare 1
    /if (${combat}==1) /varset combat 0 
    /keypress Num_5 
/return 


Sub closecombat 
   /attack on 
|   /face nolook 
   :stillclose 
            /if (${foragetoggle}==1 && ${Me.AbilityReady[Forage]}) { 
               /attack off 
            /doability Forage 
            /delay 20 
            /if (${Cursor.ID}) /autoinv 
            /attack on 
         } 

/if (${Me.AbilityReady["Disarm"]} && ${taunttoggle}==1) /doability "Disarm"
/if (${Me.AbilityReady["Kick"]}) /doability "Kick" 
/if (${taunttoggle}==1 && ${Me.AbilityReady["Taunt"]}) /doability "Taunt" 
    /doevents 
/if (${snaretoggle}==1 && ${needsnare}==1 && ${Target.PctHPs}<70) { 
      /call Cast "Ensnare" gem4 
      /varset needsnare 0 
     } 
    /if (${Target.Distance}<18 && ${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} 
/return 

Sub event_sow

Sub event_eagle 
      /call Cast "Eagle Eye" gem5 
      /delay 5s 
/return 

Sub event_haste 
      /call Cast "Eyepatch of Plunder" item 
      /delay 4s 
/return 

Sub event_cop
      /call Cast "Call of the Predator" gem7
      /delay 5s
/return

Sub event_sot
      /call Cast "Strength of Tunare" gem6
      /delay 5s
/return   

Sub Event_resist 
   /varset needsnare 1 
/return
Original script is taken from "theoneandonly" thanks for a great script

loadingpleasewait
a snow griffon
a snow griffon
Posts: 332
Joined: Sat Sep 14, 2002 8:46 am

Post by loadingpleasewait » Sat Sep 18, 2004 2:02 am

Um... Orriginal Script taken from ME! and your welcome.. but why on earth you would dredge up such an OLD version is beyond me..

Find the latest version here:
OLD POST!! Find Latest Arch.mac Thread Here:
http://macroquest2.com/phpBB2/viewtopic.php?t=9338


Personally I dont see anything you've updated at all.. here, to avoid confusion, and because I dont feel like bumping my own thread right now, I'm posting the most current version of this script here..
HISTORY:

September 19, 2004
New Era of Arch.mac.. Finally ini support. aliases included now to toggle functions. everything should still work
as it used to, but there is alot more "on the fly" functionability. Now using Rusty's Spell_routines.inc, so go get that.
Forage ini information has been moved to ArchSettings.ini. Ranger Entrap AA should now work out of the box.
load the mac, and type /archhelp for a full list of commands.. Good Luck, and hope you like it..

August 18, 2004
Incorporated the Lazy Ranger mac by Ranjah_Down with the array support included by zanomo.
I was going to include support for user defined snare and root spells, but I dont know how to put custom variables into #Events, since variables are declared after events, so if ya wanna use somthing different, you gotta figure it out.. = )

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


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)

It will display the experience gain as an echo and popup.
**|

Code: Select all

|** 
 arch.mac Auto-Archery 
 Version 2.0
 by loadingpleasewait 
  
 REQUIREMENT Spell_Routines.inc for reliable spell casting which can be found here: 
 http://macroquest2.com/phpBB2/viewtopic.php?t=7568

 USAGE: 
 /mac arch <forage|snare|taunt|root|verbose|noarch|autoassist|selfbuff>  
 Use all, or none, in any order seperated by spaces to do specified action 
**| 
#chat group 
#chat tell 

#include Spell_Routines.inc 
#turbo 40 
#Event exp                 "#*#experience!#*#" 
#Event reroot              "Your #*# Roots spell has worn off#*#" 
#Event reroot              "Your target resisted the #*# Roots spell#*#" 
#Event Casting             "#*#You begin casting#*#" 

#Event SetForage           "[MQ2] SetForage#*#"
#Event SetSelfBuff         "[MQ2] SetSelfBuff#*#"
#Event SetSnare            "[MQ2] SetSnare#*#"
#Event SetTaunt            "[MQ2] SetTaunt#*#"
#Event SetVerbose          "[MQ2] SetVerbose#*#"
#Event SetRoot             "[MQ2] SetRoot#*#"
#Event SetAutoAssist       "[MQ2] SetAutoAssist#*#"
#Event SetAssistDistance   "[MQ2] SetAssistDistance#*#"
#Event SetTankName         "[MQ2] SetTankName#*#"
#Event AddSelfBuff         "[MQ2] AddSelfBuff#*#"
#Event RemSelfBuff         "[MQ2] RemSelfBuff#*#"
#Event DisplayHelp         "[MQ2] DisplayHelp#*#" 
#Event ArchStatus          "[MQ2] ArchStatus#*#"
#Event SetNoArch           "[MQ2] SetNoArch#*#" 

Sub Main 

   /echo Auto-Arch Macro Loading. 
   /declare j int outer 
   /declare i int local
   /declare Version outer 0
   /declare autoassist bool outer FALSE
   /declare noInvis int outer 1 
   /declare tankname string outer "Unknown"
   /declare assistdistance outer 60 
   /declare noarch bool outer FALSE
   /declare verbose bool outer FALSE 
   /declare foragetoggle bool outer FALSE
   /declare waitforage bool outer FALSE 
   /declare invset outer 0 
   /declare notset outer -1 
   /declare sitstatus bool outer FALSE 
   /declare snaretoggle bool outer FALSE 
   /declare taunttoggle bool outer FALSE 
   /declare roottoggle bool outer FALSE 
   /declare needsnare bool outer FALSE
   /declare immunetosnare bool outer FALSE 
   /declare LDExp float outer ${Me.PctGroupLeaderExp} 
   /declare AAExp float outer ${Me.PctAAExp} 
   /declare Exp float outer ${Me.PctExp} 
   /declare battle bool outer FALSE
   /declare selfbuff bool outer FALSE
   /declare spellname string outer "none"
   /declare triggername string outer "none"
   /declare rootspell string outer "Earthen Roots"
   /declare snarespell string outer "Ensnare"
   /declare targetarray[4] string outer 

/if (${Ini[ArchSettings.ini,Version,ArchMacVersion].NotEqual[NULL]}) /varset Version ${Ini[ArchSettings.ini,Version,ArchMacVersion]}
/if (!${Version.Equal[2.0]}) {
      /echo Loading Aliases
      /delay 1s
   /squelch /alias /setforage /echo SetForage
   /squelch /alias /setselfbuff /echo SetSelfBuff
   /squelch /alias /setsnare /echo SetSnare
   /squelch /alias /settaunt /echo SetTaunt
   /squelch /alias /setverbose /echo SetVerbose
   /squelch /alias /setroot /echo SetRoot
   /squelch /alias /setnoarch /echo SetNoArch
   /squelch /alias /setautoassist /echo SetAutoAssist
   /squelch /alias /setassistdistance /echo SetAssistDistance
   /squelch /alias /settankname /echo SetTankName
   /squelch /alias /addselfbuff /echo AddSelfBuff
   /squelch /alias /remselfbuff /echo RemSelfBuff
   /squelch /alias /archhelp /echo DisplayHelp
   /squelch /alias /archstatus /echo ArchStatus 
   
      /echo Aliases Loaded, play on! 
   } else {
      /echo Version Up To Date, Finished Loading
   }
   /echo Type /ArchHelp for assistance
   
/ini "ArchSettings.ini" "Version" "ArchMacVersion" "2.0"

  /if (${Ini[ArchSettings.ini,General,RootSpell].NotEqual[NULL]}) /varset rootspell ${Ini[ArchSettings.ini,General,RootSpell]}
  /if (${Ini[ArchSettings.ini,General,SnareSpell].NotEqual[NULL]}) /varset snarespell ${Ini[ArchSettings.ini,General,SnareSpell]}
  /if (${Ini[ArchSettings.ini,General,AutoTaunt].NotEqual[NULL]}) /varset taunttoggle ${Ini[ArchSettings.ini,General,AutoTaunt]}
  /if (${Ini[ArchSettings.ini,General,AutoForage].NotEqual[NULL]}) /varset foragetoggle ${Ini[ArchSettings.ini,General,AutoForage]}
  /if (${Ini[ArchSettings.ini,General,AutoReRoot].NotEqual[NULL]}) /varset roottoggle ${Ini[ArchSettings.ini,General,AutoReRoot]}
  /if (${Ini[ArchSettings.ini,General,Verbosity].NotEqual[NULL]}) /varset verbose ${Ini[ArchSettings.ini,General,Verbosity]}
  /if (${Ini[ArchSettings.ini,General,NoArchery].NotEqual[NULL]}) /varset noarch ${Ini[ArchSettings.ini,General,NoArchery]}
  /if (${Ini[ArchSettings.ini,General,SelfBuffing].NotEqual[NULL]}) /varset selfbuff ${Ini[ArchSettings.ini,General,SelfBuffing]}
  /if (${Ini[ArchSettings.ini,General,AutoAssist].NotEqual[NULL]}) /varset autoassist ${Ini[ArchSettings.ini,General,AutoAssist]}
  /if (${Ini[ArchSettings.ini,General,TankToAssist].NotEqual[NULL]}) /varset tankname ${Ini[ArchSettings.ini,General,TankToAssist]}
  /if (${Ini[ArchSettings.ini,General,AssistDistance].NotEqual[NULL]}) /varset assistdistance ${Ini[ArchSettings.ini,General,AssistDistance]}
  /if (${Ini[ArchSettings.ini,General,AutoSnare].NotEqual[NULL]}) /varset snaretoggle ${Ini[ArchSettings.ini,General,AutoSnare]}
  /if (${snaretoggle}) {
         /varset needsnare TRUE
         /varset immunetosnare FALSE
         } 

/for i 0 to 7 
  /if (${Defined[Param${i}]}) { 
     /if (${Param${i}.Equal[snare]}) { 
         /echo "Auto-Snare enabled" 
         /varset snaretoggle TRUE 
         /varset needsnare TRUE 
         /varset immunetosnare FALSE 
         /ini "ArchSettings.ini" "General" "AutoSnare" "${snaretoggle}"
         } 
      /if (${Param${i}.Equal[taunt]}) { 
         /echo "Auto-Taunt enabled" 
         /varset taunttoggle TRUE
         /ini "ArchSettings.ini" "General" "AutoTaunt" "${taunttoggle}"
         } 
      /if (${Param${i}.Equal[forage]}) { 
         /echo "Auto-Forage enabled" 
         /varset foragetoggle TRUE 
         /ini "ArchSettings.ini" "General" "AutoForage" "${foragetoggle}"
         } 
      /if (${Param${i}.Equal[root]}) { 
         /echo "Auto-ReRoot enabled" 
         /varset roottoggle TRUE 
         /ini "ArchSettings.ini" "General" "AutoReRoot" "${roottoggle}"
         } 
      /if (${Param${i}.Equal[verbose]}) { 
         /echo "Group Anounce enabled" 
         /varset verbose TRUE
         /ini "ArchSettings.ini" "General" "Verbosity" "${verbose}" 
         } 
      /if (${Param${i}.Equal[noarch]}) { 
         /echo "Auto-Arch macro will not Auto-Arch.. go figure?!?" 
         /varset noarch TRUE
         /ini "ArchSettings.ini" "General" "NoArchery" "${noarch}" 
         } 
      /if (${Param${i}.Equal[selfbuff]}) { 
         /echo "SelfBuffing enabled" 
         /varset selfbuff TRUE
         /ini "ArchSettings.ini" "General" "SelfBuffing" "${selfbuff}" 
         } 
      /if (${Param${i}.Equal[autoassist]}) { 
         /echo "Auto-Assist enabled" 
    /assist on  
         /varset autoassist TRUE
         /ini "ArchSettings.ini" "General" "AutoAssist" "${autoassist}" 
         /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}
         /ini "ArchSettings.ini" "General" "TankToAssist" "${tankname}" 
         /echo Assist set to ${tankname} 
         /assist off
         /ini "ArchSettings.ini" "General" "AssistDistance" "${assistdistance}"  
            } 
         } 
   } 
/next i 

      /if (!${Ini[ArchSettings.ini,SelfBuffs,SelfBuff1].Length}) { 
         /for i 1 to 8 
         /ini "ArchSettings.ini" "SelfBuffs" "SelfBuff${i}" "NoBuffListed" 
         /next i 
      } 

      /if (!${Ini[ArchSettings.ini,TargetBuffs,TargetBuff1].Length}) { 
         /for i 1 to 8 
         /ini "ArchSettings.ini" "TargetBuffs" "TBuffTriggerWord${i}" "NoTriggerListed"
         /ini "ArchSettings.ini" "TargetBuffs" "TargetBuff${i}" "NoBuffListed"
         /next i 
      } 

      /if (!${Ini[ArchSettings.ini,AssistSpells,AssistSpell1].Length}) { 
         /for i 1 to 8 
         /ini "ArchSettings.ini" "AssistSpells" "ASpellTriggerWord${i}" "NoTriggerListed"
         /ini "ArchSettings.ini" "AssistSpells" "AssistSpell${i}" "NoSpellListed"
         /next i 
      } 

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

Sub Archery 
  /attack off 
  /varset battle TRUE 
  /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}) /ranged 
         /if (${foragetoggle} && ${Me.AbilityReady[Forage]}) /call forage 
/if (${snaretoggle} && ${needsnare} && ${Target.PctHPs}<40 && ${Target.Distance}<150) { 
         /if (${Ini[ArchSettings.ini,General,SnareSpell].Equal[Entrap]}) {
            /call Cast "Entrap" Alt
         } else {
            /call Cast ${snarespell} gem4 10s
         }
         /varset needsnare FALSE 
         /doevents 
         /if (${String[${Macro.Return}].Equal[CAST_RESISTED]}) /varset needsnare TRUE
         /if (${String[${Macro.Return}].Equal[CAST_IMMUNE]}) {               
            /varset needsnare FALSE 
            /varset immunetosnare TRUE 
            /if (${verbose}) /gsay %t is Immune to snare 
          }
    /if (${verbose} && !${immunetosnare} && !${needsnare}) /gsay %t has successfully been snared 
} 
    /if (${snaretoggle} && ${needsnare} && ${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 
         /if (${selfbuff}) /call LazyRanger 
    /goto :CloserAF 
:EndAF 
    /echo a ${targetarray[2]} ${targetarray[1]} is dead 
    /if (${snaretoggle}) { 
      /varset needsnare TRUE 
      /varset immunetosnare FALSE 
   } 
    /keypress Num_5 
       /if (${sitstatus}) { 
      /sit 
      /varset sitstatus FALSE 
   } 
   /varset battle FALSE 
/return 

Sub closecombat 
  /attack on 
   :stillclose 
            /if (${foragetoggle} && ${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} && ${Target.Distance}<11 && ${Me.AbilityReady["Taunt"]}) /doability "Taunt" 
      /doevents 
/if (${snaretoggle} && ${needsnare} && ${Target.PctHPs}<40 && ${Target.Distance}<150) { 
         /if (${Ini[ArchSettings.ini,General,SnareSpell].Equal[Entrap]}) {
            /call Cast "Entrap" Alt
         } else {
            /call Cast ${snarespell} gem4 10s
         }
         /varset needsnare FALSE 
         /doevents 
         /if (${String[${Macro.Return}].Equal[CAST_RESISTED]}) /varset needsnare TRUE
         /if (${String[${Macro.Return}].Equal[CAST_IMMUNE]}) {               
            /varset needsnare FALSE 
            /varset immunetosnare TRUE 
            /if (${verbose}) /gsay %t is Immune to snare 
          }
    /if (${verbose} && !${immunetosnare} && !${needsnare}) /gsay %t has successfully been snared 
} 
    /if (${snaretoggle} && ${needsnare} && ${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 
  /echo ** XP-Delta: REG (${Math.Calc[${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[${Me.PctGroupLeaderExp}-${LDExp}]}%) 
  /varset LDExp ${Me.PctGroupLeaderExp} 
  /varset AAExp ${Me.PctAAExp} 
  /varset Exp ${Me.PctExp} 
/return 


Sub event_reroot 
      /if (${roottoggle}) { 
         /target npc ${targetarray[3]} 
         /call Cast "${rootspell}" gem2 10s
      } 
/return 

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

sub forage 
   /delay 3s 
   /if (${Me.Sitting}) { 
      /stand 
      /varset sitstatus TRUE 
   } 
   /if (${Me.Ducking}) /stand 
    
  :WaitLoop 
   /if (${Me.Casting.ID}) { 
      /delay 1 
      /goto :WaitLoop 
   } else { 
   /doability Forage 
   /delay 2s 
   /doevents 
   } 
       
   /call destroyornot 
   /if (${sitstatus}) { 
      /sit 
      /varset sitstatus FALSE 
   } 

/return 

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

sub destroyornot 
   /varset invset ${Ini[ArchForage.ini,ForageList,${Cursor.Name},${notset}]} 
   /delay 3 
   /if (${invset}==${notset}) { 
      /ini "ArchSettings.ini" "ForageList" "${Cursor.Name}" "1" 
      /varset invset 1 
      } 
   /if (${invset}) { 
      /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 

Sub Event_SetForage
  /if (${foragetoggle}) { 
    /varset foragetoggle FALSE 
    /echo ** Auto-Forage is now OFF! 
  } else { 
    /varset foragetoggle TRUE 
    /echo ** Auto-Forage is now ON! 
  } 
   /ini "ArchSettings.ini" "General" "AutoForage" "${foragetoggle}"
/return 
           
Sub Event_SetSelfBuff        
  /if (${selfbuff}) { 
    /varset selfbuff FALSE 
    /echo ** Self Buffing is now OFF! 
  } else { 
    /varset selfbuff TRUE 
    /echo ** Self Buffing is now ON! 
  } 
   /ini "ArchSettings.ini" "General" "SelfBuffing" "${selfbuff}" 
/return 

Sub Event_SetSnare(string Line)
  /if (${Line.Arg[3].Length}) {
   /varset snarespell ${Line.Arg[3]} 
  /ini "ArchSettings.ini" "General" "SnareSpell" "${snarespell}"
} else {
   /if (${snaretoggle}) { 
    /varset snaretoggle FALSE 
    /echo ** Auto-Snare is now OFF! 
  } else { 
    /varset snaretoggle TRUE 
    /echo ** Auto-Snare is now ON! 
  }
}
  /echo ** SnareSpell == ${snarespell}
   /ini "ArchSettings.ini" "General" "AutoSnare" "${snaretoggle}" 
/return 
           
Sub Event_SetTaunt           
  /if (${taunttoggle}) { 
    /varset taunttoggle FALSE 
    /echo ** Auto-Taunt is now OFF! 
  } else { 
    /varset taunttoggle TRUE 
    /echo ** Auto-Taunt is now ON! 
  } 
   /ini "ArchSettings.ini" "General" "AutoTaunt" "${taunttoggle}"
/return 

Sub Event_SetVerbose
  /if (${verbose}) { 
    /varset verbose FALSE 
    /echo ** Verbosity is now OFF! 
  } else { 
    /varset verbose TRUE 
    /echo ** Verbosity is now ON! 
  } 
   /ini "ArchSettings.ini" "General" "Verbosity" "${verbose}" 
/return 

Sub Event_SetNoArch
  /if (${verbose}) { 
    /varset noarch FALSE 
    /echo ** Archery is now ON! 
  } else { 
    /varset noarch TRUE 
    /echo ** Archery is now OFF! 
  } 
   /ini "ArchSettings.ini" "General" "NoArchery" "${noarch}" 
/return 
         
Sub Event_SetRoot(string Line)
  /if (${Line.Arg[3].Length}) {
   /varset rootspell ${Line.Arg[3]} 
  /ini "ArchSettings.ini" "General" "RootSpell" "${rootspell}"
} else {
   /if (${roottoggle}) { 
    /varset roottoggle FALSE 
    /echo ** Auto-ReRoot is now OFF! 
  } else { 
    /varset roottoggle TRUE 
    /echo ** Auto-ReRoot is now ON! 
  }
} 
  /echo ** RootSpell == ${rootspell} 
   /ini "ArchSettings.ini" "General" "AutoReRoot" "${roottoggle}"
/return 
            
Sub Event_SetAutoAssist
  /if (${autoassist}) { 
    /varset autoassist FALSE 
    /echo ** AutoAssist is now OFF! 
  } else { 
    /varset autoassist TRUE 
    /echo ** AutoAssist is now ON! 
  } 
    /ini "ArchSettings.ini" "General" "AutoAssist" "${autoassist}" 
/return 
     
Sub Event_SetAssistDistance(string Line)
  /if (${Line.Arg[3].Length}) /varset assistdistance ${Line.Arg[3]} 
   /echo ** New AssistDistance == ${assistdistance} 
    /ini "ArchSettings.ini" "General" "AssistDistance" "${assistdistance}" 
/return 

Sub Event_SetTankName(string Line)
  /if (${Line.Arg[3].Length}) /varset tankname ${Line.Arg[3]} 
   /echo ** New TankName == ${tankname} 
    /ini "ArchSettings.ini" "General" "TankToAssist" "${tankname}" 
/return 


|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
| Lazy Ranger subs 
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

Sub LazyRanger 

|====[Self Buffs]======================================== 

/for j 1 to 8 
      /varset spellname "${Ini[ArchSettings.ini,SelfBuffs,SelfBuff${j}]}"
      /if (${String[${spellname}].NotEqual[NoBuffListed]}) { 
            /if (!${Me.Buff[${spellname}].ID}) {
            /target ${Me} 
            /call Cast ${spellname} gem6 ${Math.Calc[${Spell[${spellname}].MyCastTime}+${Spell[${spellname}].RecastTime}+5].Int}s
         }
      }
/next j 
    /if (${battle}) /target ${targetarray[3]} 
    /doevents 
/return 

Sub Event_AddSelfBuff(string Line) 
  /if (${Line.Arg[3].Length}) { 
    /for j 1 to 20 
      /if (${Ini[ArchSettings.ini,SelfBuffs,SelfBuff${j}].Equal[NoBuffListed]}) { 
        /ini "ArchSettings.ini" "SelfBuffs" "SelfBuff${j}" "${Line.Arg[3]}" 
        /echo ** ${Line.Arg[3]} added as a SelfBuff. 
        /goto :FallOut 
      } 
    /next j 
    /echo ** Self Buff slots all filled! Get rid of some! 
  } else { 
    /echo ** Huh? 
  } 
  :FallOut 
/return 

Sub Event_RemSelfBuff(string Line) 
  /if (${Line.Arg[3].Length}) { 
    /for j 1 to 20 
      /if (${Ini[ArchSettings.ini,SelfBuffs,SelfBuff${j}].Equal[${Line.Arg[3]}]}) { 
        /ini "ArchSettings.ini" "SelfBuffs" "SelfBuff${j}" "NoBuffListed" 
        /echo ** ${Line.Arg[3]} removed as a SelfBuff. 
        /goto :FallOut 
      } 
    /next j 
    /echo ** Can't find ${Line.Arg[3]} in SelfBuff list! 
  } else { 
    /echo ** Huh? 
  } 
  :FallOut 
/return 

Sub Event_Chat(ChatType,Sender,ChatText) 

|====[Target Buffs]======================================== 
/for j 1 to 8 
      /if (!${Ini[ArchSettings.ini,TargetBuffs,TargetBuff${j}].Equal[NoBuffListed]}) { 
         /varset triggername "${Ini[ArchSettings.ini,TargetBuffs,TBuffTriggerWord${j}]}"
         /varset spellname "${Ini[ArchSettings.ini,TargetBuffs,TargetBuff${j}]}"
         /if ( ${ChatText.Find[${triggername}]} ) { 
            /target ${Sender} 
            /delay 2s 
            /call cast ${spellname} gem6 ${Math.Calc[${Spell[${spellname}].MyCastTime}+${Spell[${spellname}].RecastTime}+5].Int}s
            /tell ${Sender} inc ${triggername} 
         }
      } 
/next j 

|====[Assist Buffs]======================================== 
/for j 1 to 8 
      /if (!${Ini[ArchSettings.ini,AssistSpells,AssistSpell${j}].Equal[NoSpellListed]}) { 
         /varset triggername "${Ini[ArchSettings.ini,AssistSpell,ASpellTriggerWord${j}]}"
         /varset spellname "${Ini[ArchSettings.ini,AssistSpells,AssistSpell${j}]}"
         /if ( ${ChatText.Find[${triggername}]} ) { 
               /assist ${Sender} 
               /delay 2s 
               /call cast ${spellname} gem6 ${Math.Calc[${Spell[${spellname}].MyCastTime}+${Spell[${spellname}].RecastTime}+5].Int}s
               /tell ${Sender} Inc ${spellname]} on %T. 
            }
         } 
/next j 
    /if (${battle}) /target ${targetarray[3]} 
/return 

|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
| End Lazy Ranger subs 
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

sub Event_DisplayHelp 
   /echo -=Arch.Mac Help=-
   /echo /SetSnare <SnareSpell> Toggles AutoSnare off/on or sets the snare spell
   /echo /SetRoot <RootSpell> Toggles AutoReRoot off/on or sets the root spell
   /echo /SetTaunt Toggles AutoTaunt off/on
   /echo /SetForage Toggles AutoForage off/on
   /echo /SetVerbose Toggles Verbosity off/on
   /echo /SetSelfBuff Toggles SelfBuffing off/on
   /echo /AddSelfBuff <BuffName> Adds a SelfBuff
   /echo /RemSelfBuff <BuffName> Removes a SelfBuff
   /echo /SetAutoAssist Toggles AutoAssist off/on
   /echo /SetTankName <TankName> Sets the TankName to AutoAssist
   /echo /SetAssistdistance <distance> Sets the distance to target to start attacking
   /echo /SetNoArch Turns Archery Off and On
   /echo /ArchHelp Shows this dialog
   /echo /ArchStatus Shows Current Status
/return

sub Event_ArchStatus
   /echo -=Arch.Mac Status=-
   /echo AutoSnare: ${snaretoggle}, SnareSpell: ${snarespell}
   /echo AutoReRoot: ${roottoggle}, RootSpell: ${rootspell}
   /echo AutoTaunt: ${taunttoggle}
   /echo AutoForage: ${foragetoggle}
   /echo Verbosity: ${verbose}
   /echo NoArchery: ${noarch}
   /echo AutoSelfBuff: ${selfbuff}
   /echo AutoAssist: ${autoassist}, TankName: ${tankname}, AssistDistance: ${assistdistance}
   /echo Status Complete....
/return
   

|** 
  HISTORY: 
  
 September 19, 2004
 New Era of Arch.mac.. Finally ini support.  aliases included now to toggle functions. everything should still work 
 as it used to, but there is alot more "on the fly" functionability. Now using Rusty's Spell_routines.inc, so go get that. 
 Forage ini information has been moved to ArchSettings.ini.  Ranger Entrap AA should now work out of the box. 
 load the mac, and type /archhelp for a full list of commands.. Good Luck, and hope you like it.. 
  
 August 18, 2004 
 Incorporated the Lazy Ranger mac by Ranjah_Down with the array support included by zanomo. 
 I was going to include support for user defined snare and root spells, but I dont know how to put custom variables into #Events, since variables are declared after events, so if ya wanna use somthing different, you gotta figure it out.. = ) 
  
 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  
  
  
 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) 
  
 It will display the experience gain as an echo and popup. 
**| 
Last edited by loadingpleasewait on Sun Sep 19, 2004 12:48 pm, edited 1 time in total.
LOADING PLEASE WAIT...

zanlez
orc pawn
orc pawn
Posts: 10
Joined: Thu Sep 16, 2004 8:58 am

Post by zanlez » Sat Sep 18, 2004 12:30 pm

Yeah i was using that code before. But i never got it to work. For me it had a bunch of errors. The code i took was taken from theoneandonly who might've taken your code and edited it. Anyways. Some of the changes i made was that it would assist on any inc message in group. Sow a person if it asked for it and if someone asks for a sow during a battle it retartegs the mob and contiues attacking. Moved the forage event to the :mainloop so it would forage even if you're not attacking.

No big changes just some tweaking here and there

zanlez
orc pawn
orc pawn
Posts: 10
Joined: Thu Sep 16, 2004 8:58 am

Post by zanlez » Tue Sep 21, 2004 5:28 pm

Sorry shouldn't have posted it here. it's a work under progress. You'll see my final bot when i'm satisfied with it. Still got a few more things to add.
Fyi. There's alot of changes. The original bot you wrote didn't even work for me so i started rescripting and adding stuff. you'll see when it comes out.

pab05
a lesser mummy
a lesser mummy
Posts: 42
Joined: Thu Aug 14, 2003 12:24 am

Post by pab05 » Sun Mar 27, 2005 2:00 pm

Hey all 55 ranger here. Im trying to run this in groups so i can afk. I keep gettin a "Couldn't Open Include file : C:/MQ2/Macros/Spell_Routines.inc" message i got the sepll routines.inc... anyone know what is goin on?

eqrangerguy
orc pawn
orc pawn
Posts: 20
Joined: Tue Mar 08, 2005 10:01 am

Post by eqrangerguy » Mon Mar 28, 2005 1:05 am

hoping to help you avoid the fire around here.. Make sure you named the Spell_Routines.inc file the right way. If you mispelled it, *and maybe miscapitolized it, not sure* it won't find it. Also, make sure you saved it the right way, and it isn't just a txt file in disguise. ie: Spell_Routines.inc.txt


Good luck Pab05