Code: Select all
| Hunter Macro
| Hunter.mac
| Author : robdawg
| Version : v1.2 2004-05-13 10:06pm PST
| Useage : /macro Hunter
| Description : This macro will run your character around killing any mobs in your
| RV_MobArray. Then it will attempt to loot all items in your
| RV_LootArray. This is definitely a work in progress and I am sure
| someone can think of plenty of upgrades for this.
|------------------------------------------------------------------------------------
#include spellcast.inc
#Event FEROC "#*#The ferocity fades.#*#"
#Event SV "#*#Your spiritual vigor fades.#*#"
#Event DOMIN "#*#The dominion fades.#*#"
#Event IOS "#*#Your power fades.#*#"
#Event STR "#*#Your Furious Strength fades.#*#"
#Event REGEN "#*#You have stopped regenerating.#*#"
#Event HASTE "#*#Your speed returns to normal.#*#"
#Event TALIS "#*#Your hit points fade.#*#"
#Event FREN "#*#Your frenzy fades.#*#"
#Event STA "#*#Your stamina fades.#*#"
#Event DEX "#*#Your dexterity fades.#*#"
#Event PETSS "#*#Your pet's Spiritual Strength spell has worn off.#*#"
#Event PETIOS "#*#Your pet's Infusion of Spirit spell has worn off.#*#"
#Event PETSTR "#*#Your pet's Furious Strength spell has worn off.#*#"
#Event PETHASTE "#*#Your pet's Arag's Celerity spell has worn off.#*#"
#Event PETPROC "#*#Your pet's Spirit of Relic spell has worn off.#*#"
#Event PETDEX "#*#Your pet's Dexterity spell has worn off.#*#"
#Event PETSOW "#*#Your pet's Spirit of Wolf spell has worn off.#*#"
#Event SLAINBY "#*#You have been slain by#*# "
#turbo 10
Sub Main
|------------------------------------------------------------
|How many times should aquire target fail before delaying?
|------------------------------------------------------------
/declare RV_FailMax int outer 3
|------------------------------------------------------------
|How far would you like to target a mob?
|------------------------------------------------------------
/declare RV_MaxRadius int outer 3000
|------------------------------------------------------------
|How far is the combat range?
|------------------------------------------------------------
/declare RV_Range int outer 10
|------------------------------------------------------------
|What is the minimum Z Value of mobs I should target?
|------------------------------------------------------------
/declare RV_MinZRange int outer -1000
|------------------------------------------------------------
|What is the maximum Z Value of mobs I should target?
|------------------------------------------------------------
/declare RV_MaxZRange int outer 1000
|------------------------------------------------------------
|Should I loot all items?
|------------------------------------------------------------
/declare RV_LootAllItems int outer 0
|------------------------------------------------------------
|Should I display stats?
|------------------------------------------------------------
/declare RV_DisplayStats int outer 1
|------------------------------------------------------------
|How far away should I stop and cast spells?
|------------------------------------------------------------
/declare RV_SpellDistance int outer 150
|------------------------------------------------------------
|Loot Array Information.
|------------------------------------------------------------
/call ReadINI HunterMob.ini "${Zone.Name}"
/if (!${Defined[RV_MobArray]}) {
/echo Mob Array Creation Error, ending macro...
/endmacro
}
|------------------------------------------------------------
|Mob Array Information.
|------------------------------------------------------------
/call ReadINI HunterLoot.ini "${Zone.Name}"
/if (!${Defined[RV_LootArray]}) {
/echo No Loot Array Created...
}
|------------------------------------------------------------
|Avoid Mob Array Information.
|------------------------------------------------------------
/call ReadINI HunterAvoidMob.ini "${Zone.Name}"
/if (!${Defined[RV_AvoidMobArray]}) {
/echo No Loot Array Created...
}
|------------------------------------------------------------
|Variables that you don't need to worry about.
|------------------------------------------------------------
/declare RV_FailCounter int outer 0
/declare RV_MyTargetID int outer 0
/declare RV_MyTargetName string outer
/declare RV_MyTargetDead int outer 0
/declare RV_InvalidTargetID int outer 0
/declare RV_HasTarget int outer 0
/declare RV_RandomWait int outer 0
/declare RV_LootSlot int outer 0
/declare RV_CheckLook int outer 0
/declare RV_Fighting int outer 0
/declare RV_TargetDead int outer 0
/declare RV_MyXLOC int outer 0
/declare RV_MyYLOC int outer 0
/declare RV_AnchorXLOC int outer 0
/declare RV_AnchorYLOC int outer 0
/declare RV_FastRange int outer
/declare RV_RangeMax int outer
/declare RV_RangeMin int outer
/varcalc RV_FastRange ${RV_Range}+3
/varcalc RV_RangeMax ${RV_Range}+1
/varcalc RV_RangeMin ${RV_Range}-1
/declare RV_CastNow int outer 1
/varset RV_AnchorXLOC ${Int[${Me.X}]}
/varset RV_AnchorYLOC ${Int[${Me.Y}]}
/keypress esc
/echo Anchor dropped at ${RV_AnchorXLOC},${RV_AnchorYLOC}
:Start
/call GMCheck
/call GetTarget
:KillAdds
/if (${RV_HasTarget}) /call MoveToMob
/if (${RV_HasTarget}) /call CombatSub
/if (${RV_HasTarget}) /call MoveToMob
/if (${RV_HasTarget} && (${Defined[RV_LootArray]} || ${RV_LootAllItems})) /call LootMob
/if (${RV_DisplayStats}) /call DisplayStats
/if (${Target.ID}) {
/echo Looks like something is attacking us, killing it...
/delay 1s
/varset RV_HasTarget 1
/varset RV_Fighting 1
/goto :KillAdds
}
/call ResetSub
/varset RV_RandomWait ${Math.Rand[5]}
/varcalc RV_RandomWait ${RV_RandomWait}+1
/echo Paranoia - Waiting ${RV_RandomWait} seconds before resuming
/delay ${RV_RandomWait}s
/pet hold
/goto :Start
/return
|--------------------------------------------------------------------------------
|SUB: Aquire Target
|--------------------------------------------------------------------------------
Sub GetTarget
/declare RV_CurrentRadius int local
/declare RV_TargetSub int local
/echo Looking for mobs.
:Acquire
/for RV_CurrentRadius 100 to ${RV_MaxRadius} step 100
/for RV_TargetSub 1 to ${RV_MobArray.Size}
/squelch /target radius ${RV_CurrentRadius} nopcnear notid ${RV_InvalidTargetID} npc "${RV_MobArray[${RV_TargetSub}]}"
/varset RV_MyTargetID ${Target.ID}
/varset RV_MyTargetDead 0
/if (${Target.ID}) {
/if (${Int[${Target.PctHPs}]}<100) {
/echo Mob NOT a Full Health, picking another...
/varset RV_InvalidTargetID ${Target.ID}
/call ResetSub
/goto :Acquire
}
/if (${Int[${Target.Z}]}<${RV_MinZRange}) {
/echo Mob is BELOW Min Z Range, picking another...
/varset RV_InvalidTargetID ${Target.ID}
/call ResetSub
/goto :Acquire
}
/if (${Int[${Target.Z}]}>${RV_MaxZRange}) {
/echo Mob is ABOVE Max Z Range, picking another...
/varset RV_InvalidTargetID ${Target.ID}
/call ResetSub
/goto :Acquire
}
/varset RV_HasTarget 1
/varset RV_MyTargetName ${Target.Name}
/echo Acquired ${Target.Name} at range ${Int[${Target.Distance}]}
/return
}
/next RV_TargetSub
/delay 2
/next RV_CurrentRadius
/if (!${Target.ID}) {
/delay 2s
/varcalc RV_FailCounter ${RV_FailCounter}+1
|/echo Failed to Acquire Target in Range ${RV_MaxRadius} ${RV_FailCounter} Time(s)
/if (${RV_FailCounter}>=${RV_FailMax}) {
/echo Waiting for Respawns, Resetting Failure Counter...
/delay 60s
/echo Looking for Mobs again.
/varset RV_FailCounter 0
}
/goto :Acquire
}
/return
|--------------------------------------------------------------------------------
|SUB: Moving
|--------------------------------------------------------------------------------
Sub MoveToMob
/varset RV_MyXLOC ${Int[${Me.X}]}
/varset RV_MyYLOC ${Int[${Me.Y}]}
/declare RV_DistanceTimer timer 15
/declare Element int local 1
/declare TempMobID int local
/declare TempSingle int local 1
:MovementLoop
/if ((!${RV_Fighting})&&(!${RV_TargetDead})&&(${Target.PctHPs}<100)) {
/echo Mob not at full health, picking another...
/varset RV_InvalidTargetID ${Target.ID}
/varset RV_HasTarget 0
/call ResetSub
/return
}
:AvoidCheckLoop
/varset TempMobID ${Spawn[npc radius 400].ID}
/if (${AvoidList[${Element}].Equal[${Spawn[ID ${TempMobID}].CleanName}]}) {
/if (${TempSingle}){
/echo AVOIDING ${AvoidList[${Element}]}
/call MoveToAnchor
/pet back off
/pet hold
/pet follow
/return
}
}
/varcalc Element ${Element}+1
|/if ((${Int[${Me.PctHPs}]}<50)) {
/if (${AvoidList[${Element}].NotEqual[UNDEFINED-ARRAY-ELEMENT]}) {
/goto :AvoidCheckLoop
}
/if (${Target.ID}) {
/face fast
}
/if (${Int[${Target.Distance}]}>${RV_FastRange}) {
/keypress forward hold
}
/if (${Int[${Target.Distance}]}<${RV_SpellDistance}) {
/if (${RV_CastNow}==1) {
/keypress forward
/call Cast "Sha's Advantage"
/varset RV_CastNow 2
/return
}
}
/if (${Int[${Target.Distance}]}<${RV_FastRange}&&${Int[${Target.Distance}]}>${RV_RangeMax}) {
/keypress forward
}
/if (${Int[${Target.Distance}]}<${RV_RangeMin}) {
/keypress back
}
/if (!${RV_DistanceTimer}) {
/if ((${RV_MyXLOC}==${Int[${Me.X}]})&&(${RV_MyYLOC}==${Int[${Me.Y}]})) /call HitObstacle
/varset RV_MyXLOC ${Int[${Me.X}]}
/varset RV_MyYLOC ${Int[${Me.Y}]}
/varset RV_DistanceTimer 15
/goto :Movementloop
}
/if (${Int[${Target.Distance}]}>${RV_FastRange}) /goto :MovementLoop
/return
|--------------------------------------------------------------------------------
|SUB: Combat
|--------------------------------------------------------------------------------
Sub CombatSub
/echo Attacking Mob NOW!
/varset RV_Fighting 1
/varset RV_TargetDead 0
:CombatLoop
/attack on
/if (${RV_CastNow}==3) {
/call MoveToMob
} else {
/if (${Int[${Target.Distance}]}<${RV_Range}) {
/varset RV_CastNow 3
/pet attack
}
/face ${Target}
}
/call SpecialIT
/if (!${Target.ID}) {
/attack off
/keypress forward
/keypress back
/varset RV_TargetDead 1
/varset RV_Fighting 0
/delay 1s
/target radius 30 corpse
/delay 1s
/if (!${Target.ID}) {
/call ResetSub
/return
}
/face fast
}
/if (!${RV_TargetDead}) {
/goto :CombatLoop
}
/varset RV_CastNow 0
/return
|--------------------------------------------------------------------------------
|SUB: Special Combat
|--------------------------------------------------------------------------------
Sub SpecialIt
/declare TempID int inner 0
/if ((${Target.Distance}<11)&&(${Me.AbilityReady["Kick"]})) /doability "Kick"
/if ((${Int[${Me.PctHPs}]}<50)) {
/call Cast "Chloroblast"
}
/call Cast "Paragon of Spirit" activate
/return
|--------------------------------------------------------------------------------
|SUB: Looting
|--------------------------------------------------------------------------------
Sub LootMob
/declare LootSlot int inner 0
/declare LootCheck int inner 0
/declare LootTotal int inner 0
/declare iCount int local 1
/target corpse radius 100 nopcnear "${RV_MobArray[${iCount}]}"
/face fast
/keypress forward
/keypress back
/fastdrop on
/lootn never
/delay 1s
/loot
/delay 1s
/if (!${Corpse.Items}) {
/echo NO LOOT! Cheap Bastard!
/keypress esc
/return
}
/varset LootTotal ${Corpse.Items}
/for LootSlot 1 to ${LootTotal}
/itemnotify loot${LootSlot} leftmouseup
/delay 1s
/if (${RV_LootAllItems}) {
/echo Keeping a ${Cursor.Name}... WOOT!
/autoinventory
/delay 1s
} else {
/for LootCheck 1 to ${RV_LootArray.Size}
/if (!${Me.FreeInventory}) {
/beep
/beep
/beep
/beep
/echo ** INVENTORY FULL !
/quit
/endmacro
}
/if (${Cursor.Name.Find[${RV_LootArray[${LootCheck}]}]}) {
/echo Keeping a ${Cursor.Name}... WOOT!
/varcalc RV_LootStats[${LootCheck}] ${RV_LootStats[${LootCheck}]}+1
/autoinventory
/delay 1s
}
/next LootCheck
}
/if (${Cursor.ID}) {
/echo Destroying a ${Cursor.Name}...
/destroy
/delay 1s
}
/next LootSlot
/keypress esc
:LootOther
/target corpse radius 100 nopcnear "${RV_MobArray[${iCount}]}"
/if (${Target.ID}) {
/call LootMob
}
/varcalc iCount ${iCount}+1
/if ((${Int[${iCount}]}<${Int[${RV_MobArray.Size}]})) /goto :LootOther
/keypress esc
/return
|--------------------------------------------------------------------------------
|SUB: Reset
|--------------------------------------------------------------------------------
Sub ResetSub
/call MoveToAnchor
/keypress esc
/doevents
/keypress esc
/keypress esc
/keypress esc
/keypress esc
/varset RV_HasTarget 0
/varset RV_TargetDead 0
/varset RV_Fighting 0
/varset RV_CastNow 1
/return
|-------------------------------------------------------------------------------
|Return to Anchor
|-------------------------------------------------------------------------------
Sub MoveToAnchor
/declare iCount int local
/declare TempMobID int local
/declare Element int local 1
/varset RV_MyXLOC ${Me.X}
/varset RV_MyYLOC ${Me.Y}
/varset iCount 0
/declare RV_DistanceTimer timer 15
/echo Moving to Anchor at Loc: ${RV_AnchorXLOC}, ${RV_AnchorYLOC}.
:AnchorMoveLoop
/delay 1
:AvoidCheckLoopAnchor
/varset TempMobID ${Spawn[npc radius 400].ID}
/if (${AvoidList[${Element}].Equal[${Spawn[ID ${TempMobID}].CleanName}]}) {
/if (${TempMobID}) {
/face nolook ${TempMobID}
/if (${Math.Rand[2]}) {
/keypress strafe_right hold
/keypress back hold
} else {
/keypress strafe_left hold
/keypress back hold
}
/delay ${Math.Calc[${Math.Rand[15]}+30]}
/keypress strafe_right
/keypress forward
/keypress strafe_left
}
}
/varcalc Element ${Element}+1
/if (${AvoidList[${Element}].NotEqual[UNDEFINED-ARRAY-ELEMENT]}) {
/goto :AvoidCheckLoopAnchor
}
|/face nolook loc $(+{RV_AnchorXLoc}),$(+{RV_AnchorYLoc})
/face nolook loc ${RV_AnchorYLOC},${RV_AnchorXLOC}
/if (${Math.Distance[${RV_AnchorYLOC},${RV_AnchorXLOC}]}>10) {
/keypress forward hold
} else {
/keypress forward
/echo Moved to Anchor at Loc: ${Me.X}, ${Me.Y}.
/return
}
/if (${iCount}>2) {
/if (!${RV_DistanceTimer}) {
/if ((${RV_MyXLOC}==${Int[${Me.X}]})&&(${RV_MyYLOC}==${Int[${Me.Y}]})) /call HitObstacle
/varset RV_MyXLOC ${Int[${Me.X}]}
/varset RV_MyYLOC ${Int[${Me.Y}]}
/varset RV_DistanceTimer 15
/face nolook loc ${AnchorYLOC},${AnchorXLOC}
/varset iCount 0
/goto :AnchorMoveLoop
}
/varcalc iCount ${iCount}+1
/goto :AnchorMoveLoop
}
/goto :AnchorMoveLoop
/return
|--------------------------------------------------------------------------------
|SUB: Obstacle Avoidance
|--------------------------------------------------------------------------------
Sub HitObstacle
/echo Obstacle hit, moving around it...
/keypress forward
/keypress back hold
/delay ${Math.Calc[${Math.Rand[5]}+6]}
/keypress back
/if (${Math.Rand[2]}) {
/keypress strafe_right hold
/keypress forward hold
} else {
/keypress strafe_left hold
/keypress forward hold
}
/delay ${Math.Calc[${Math.Rand[15]}+12]}
/keypress strafe_right
/keypress strafe_left
/return
|--------------------------------------------------------------------------------
|SUB: GM Check
|--------------------------------------------------------------------------------
Sub GMCheck
/if (${Spawn[gm].ID}) {
/beep
/beep
/beep
/echo GM has entered the zone!
/echo FUCK HIM but ending the macro...
/keypress forward
/keypress back
/quit
/endmacro
}
/return
|--------------------------------------------------------------------------------
|SUB: Reading from an INI File
|--------------------------------------------------------------------------------
Sub ReadINI(FileName,SectionName)
/echo Attempting to Read Section "${SectionName}" Zone Information from ${FileName}...
/delay 1s
/if (${Ini[${FileName},${SectionName},-1,NO].Equal[NO]}) {
/echo "${SectionName}" is not a Valid Section for FILE:${FileName}, ending macro...
/delay 1s
/return
}
/declare nValues int local 1
/declare nArray int local 0
/declare KeySet string local ${Ini[${FileName},${SectionName}]}
:CounterLoop
/if (!${KeySet.Arg[${nValues},|].Length}) {
/varcalc nValues ${nValues}-1
/goto :MakeArray
}
/varcalc nValues ${nValues}+1
/goto :CounterLoop
:MakeArray
/if (!${nValues}) /return
/if (${FileName.Equal["HunterMob.ini"]}&&${nValues}>0) {
/echo Declaring Mob Array...
/declare RV_MobArray[${nValues}] string outer
/declare RV_MobStats[${nValues}] string outer
}
/if (${FileName.Equal["HunterLoot.ini"]}&&${nValues}>0) {
/echo Declaring Loot Array...
/declare RV_LootArray[${nValues}] string outer
/declare RV_LootStats[${nValues}] string outer
}
/if (${FileName.Equal["HunterAvoidMob.ini"]}&&${nValues}>0) {
/echo Declaring AvoidMob Array...
/declare AvoidList[${nValues}] string outer
}
/for nArray 1 to ${nValues}
/if (${FileName.Equal["HunterMob.ini"]}) {
/varset RV_MobArray[${nArray}] ${Ini[${FileName},${SectionName},${KeySet.Arg[${nArray},|]},NULL]}
/varset RV_MobStats[${nArray}] 0
}
/if (${FileName.Equal["HunterLoot.ini"]}) {
/varset RV_LootArray[${nArray}] ${Ini[${FileName},${SectionName},${KeySet.Arg[${nArray},|]},NULL]}
/varset RV_LootStats[${nArray}] 0
}
/if (${FileName.Equal["HunterAvoidList.ini"]}) {
/varset _AvoidList[${nArray}] ${Ini[${FileName},${SectionName},${KeySet.Arg[${nArray},|]},NULL]}
}
/next nArray
/echo "${SectionName}" Zone Information Read Successfully from ${FileName}...
/delay 1s
/return
|--------------------------------------------------------------------------------
|SUB: Display Stats
|--------------------------------------------------------------------------------
Sub DisplayStats
/declare nArray int local
/if (${Defined[RV_LootArray]}) {
/for nArray 1 to ${RV_LootArray.Size}
/echo ${Int[${RV_LootStats[${nArray}]}]} ${RV_LootArray[${nArray}]}'s
/next nArray
}
/return
| ----- Events called by /DoEvents -----
Sub Event_FEROC
/keypress tab
/call Cast "Ferocity"
/keypress tab
/return
Sub Event_DOMIN
/call Cast "Spiritual Dominion"
/return
Sub Event_SV
/call Cast "Spiritual Vigor"
/return
Sub Event_IOS
/keypress tab
/call Cast "Infusion of Spirit"
/keypress tab
/return
Sub Event_REGEN
/keypress tab
/call Cast "Regrowth"
/keypress tab
/return
Sub Event_STR
/keypress tab
/call Cast "Furious Strength"
/keypress tab
/return
Sub Event_TALIS
/keypress tab
/call Cast "Talisman of Kragg"
/keypress tab
/return
Sub Event_FREN
/call Cast "Frenzy"
/return
Sub Event_STA
/keypress tab
/call Cast "Stamina"
/keypress tab
/return
Sub Event_DEX
/keypress tab
/call Cast "Dexterity"
/keypress tab
/return
Sub Event_HASTE
/keypress tab
/call Cast "Celerity"
/keypress tab
/return
Sub Event_PETHASTE
/target pet
/call Cast "Arag's Celerity"
/assist ${sAssistName}
/return
Sub Event_PETIOS
/target pet
/call Cast "Infusion of Spirit"
/assist ${sAssistName}
/return
Sub Event_PETSTR
/target pet
/call Cast "Furious Strength"
/assist ${sAssistName}
/return
Sub Event_PETDEX
/target pet
/call Cast "Dexterity"
/assist ${sAssistName}
/return
Sub Event_PETPROC
/target pet
/call Cast "Spirit of Relic"
/assist ${sAssistName}
/return
Sub Event_PETSS
/target pet
/call Cast "Spiritual Strength"
/assist ${sAssistName}
/return
Sub Event_PETSOW
/target pet
/call Cast "Spirit of the Wolf"
/assist ${sAssistName}
/return
Code: Select all
[Eastern Plains of Karana]
Loot1=Silk
Loot2=High Quality
Loot3=Medium Quality
Loot4=Feather
[East Commonlands]
Loot1=Spiderling Silk
[The Feerrott]
Loot1=Spiderling Silk
[The Overthere]
Loot1=A Sarnak War Braid
Code: Select all
[Eastern Plains of Karana]
Mob1=Spider
Mob2=Lion
Mob3=Griffawn
[East Commonlands]
Mob1=Spiderling
[The Feerrott]
Mob1=Spider
[The Overthere]
Mob1=Sarnak
Code: Select all
[The Overthere]
Mob1=Dragoon
Mob2=General
As you can see, Ive been writing a bst flavored hunter.mac. Some custimization has happened already... but I am getting a few errors. One of them is in the Loot sub, the very last For loop. It says invalid variable for the For command. The second is that it isnt waiting till it gets to the anchor point, it just starts running there, then starts its search for mobs. Third, is there anyway I can make it stop running to the mob at around 150, stop and cast my Slow, then engage the mob? Any help here would be appreciated.
Edit: Updated code to match what I have currently.


