Code: Select all
| This macro will hunt for any particular target and loot contents
| of specified number of slots of target inventory.
| It will also med when mana low and gate when hp low.
| This works best if you are bound in same zone targets
#turbo
#define ENEMY "spiderling"
#define ROOT "Earthen Roots"
|Spell you want to root with
|Doesn't seem to work right so be sure to specify in code below
#define NUKE "Wildfire"
|Spell you want to nuke with
#define SNARE "Ensnare"
|Spell you want to snare with
#define GETOUTPLACE "Egress"
|Spell to use to port out when hp low
#define MEDPLACE "Egress"
|Spell to use to port out when mana low
#define NOLOOTA "Backpack"
|Items you don't want to loot
#define NUMSLOTS 6
|Number of slots you want to loot from
Sub Main
|Declare Variables
/declare loopvar local
/declare checkstucka local
/declare checkstuckb local
:Start
|Check mana first
/goto :CheckMana
:StartTargeting
/stand
/echo Attempting to find and attack targets!
/echo Targeting...
:Target
/target npc ENEMY nopcnear 200
|npc tag to avoid targeting and attacking corpses
|pc tag to avoid ks'ing
/if "$target()"=="FALSE" /goto :NoTarget
|No targets in zone
/if n $target(hp,pct)<100 /goto :AnothersTarget
|Likely has been attacked by someone else
/echo Heading to Target
:GotoTarget
|Check for damage as we move along
/if n $char(hp,pct)<70 /goto :GetOut
/varset checkstucka $target(distance)
|Move to target
/if n $target(distance)>=80 /sendkey down up
/if n $target(distance)<80 /sendkey up up
/if n $target(distance)<80 /goto :Cast
/face fast
/delay 1
/varset checkstuckb $target(distance)
/if @checkstucka==@checkstuckb {
|If we are stuck move back and to the side and retry
/sendkey up up
/sendkey down down
/delay 5
/sendkey up down
/sendkey down left
/delay 8
/sendkey up left
/sendkey down up
/delay 1s
/sendkey up up
/varset checkstuckb 0
}
|Move randomly side to side a bit to avoid obstacles
/if n $rand(50)==19 {
/sendkey down right
/delay 4
/sendkey up right
/delay 1s
/goto :GotoTarget
}
/if n $rand(50)==18 {
/sendkey down left
/delay 4
/sendkey up left
/delay 1s
/goto :GotoTarget
}
|Make sure target is still there
/if "$target()"=="TRUE" /goto :GotoTarget
/echo Lost Target.
/goto :Target
:Cast
/face fast
/echo Casting on Target
/delay 13
/echo Casting Root
/cast "Engorging Roots"
|Put defined ROOT here but didn't work
/delay 5s
|Back up a little to get away from rooted enemy
/sendkey down down
/delay 15
/sendkey up down
/delay 1s
/echo Casting Nuke
/cast NUKE
/delay 8s
/if "$target()"=="TRUE" /goto :GotoTarget
:Loot
/echo Approaching corpse to loot
/Target corpse ENEMY
/if "$target()"=="FALSE" /goto :DoneLooting
|Nothing left to loot
:LootLoop
|Move close to corpse
/varset checkstucka $target(distance)
/if n $target(distance)>2 /sendkey down up
/if n $target(distance)<=2 /sendkey up up
/if n $target(distance)<=2 /goto :LootCorpse
/face fast
/delay 1
/varset checkstuckb $target(distance)
/if @checkstucka==@checkstuckb /goto :Start
|If we aren't moving any closer to the corpse then we will retarget start again
/if "$target()"=="TRUE" /goto :LootLoop
|Restart if something unusual happens
/goto :Start
:LootCorpse
/echo Looting the Corpse
|Make sure we have a corpse targeted
/if "$target()"=="FALSE" /goto :Start
/loot
/delay 2s
|Go through corpse looting items
|Can change to pick up with left click, check for NO DROP and LORE, and destroy if needed
/varset loopvar 0
:LootCorpseLoop
/mouseto corpse @loopvar
/delay 4
|**
|This section just wasn't working right for me so I commented it out
/click left
/delay 1s
/if "$cursor()"=="FALSE" /goto :DoneLooting
|Skips the Nodrop items
/if "$cursor(name)"==NOLOOTA {
echo Destroying $cursor(name) in 2 seconds
/delay 2s
/destroy()
}
|Destroys the items we don't want
/mouseto auto
/delay 5
/click left
**|
/click right
/varadd loopvar 1
/delay 1
/if n @loopvar<NUMSLOTS /goto :LootCorpseLoop
:DoneLooting
/click left corpse done
/delay 1s
| /goto :Loot
|May have killed more than one during battle - messes up if there are nodrop items
|so I commented out for now
:CheckMana
/echo Checking Mana..
/echo Mana level: $char(mana,pct)
/if n $char(mana,pct)<20 /goto :Med
/echo Mana OK
/goto :StartTargeting
:Med
/echo Time to med
|goto safe place
/cast MEDPLACE
/delay 10s
:MedLoop
/if "$char(state)"=="STAND" /sit
/delay 10s
/if n $char(mana,pct)>90 /goto :Start
/echo Mana level: $char(mana,pct)
|Check for attack while medding
/if n $char(hp,pct)<75 /goto :GetOut
/goto :MedLoop
:NoTarget
/echo Could not locate a target in this zone...waiting 15 seconds to try again.
|Make sure we are not getting attacked
/if n $char(hp,pct)<70 goto :GetOut
/delay 15s
/goto :StartTargeting
:AnothersTarget
|Just to play nice, can also be from damage we already caused prior to gate
/echo Someone else has targeted this NPC
/echo Waiting 10s and resetting...
/delay 10s
/goto :Start
:GetOut
/cast GETOUTPLACE
|Cast Gate to go to safe spot, try again if doesn't work
/delay 1s
|Check and see if we got out
/target
/if n $target(distance)<200 /goto :GetOut
/delay 10s
:GetOutHeal
|Heal ourself
/target myself
/echo Complete Heal Incoming
/cast "Tunare's Renewal"
/sit
/delay 20s
/if n $char(hp,pct)<75 /goto :GetOutHeal
|Spell may have fizzled
|Try again
/goto :Start
:EndRoutine
/echo End of Routine
/return



