| ------------------------------------------------------------------
| petbot.mac v0.7 by AmericanNero 6/28/2021
| Copy / paste / and save.
| Tested.
|
| Added IgnoreList list
| Added Combat assist
| ------------------------------------------------------------------
Sub Main
/if (!${Me.Pet.ID}) {
/echo You don't have a pet out.
/endmacro
}
/echo PetBot started!
/declare IgnoreList string local
| Add names to this list that you do not want to attack. Like guards, quest givers...pipe | delimited
| If the list gets too long, change to an array and search it.
/varset IgnoreList Warden Yafeu|Zlandicar|a grove hare
/declare NearestMobID int local
| This will continuously look for nearby mobs within a radius of 100. Change to your liking.
| You may also want to give yourself a breather(?) which you can do by making the delay bigger
| near the bottom of the Kill! loop, where I placed a message.
| Search loop
/while (1) {
/if (!${Me.Pet.ID}) {
/echo Your pet has died / suspended / leave. Ending
/endmacro
}
/if (!${Me.CombatState.Equal[combat]}) {
| Find something to kill. Note that non-hostile npcs will also be attacked. You can add an array to ignore them. Consider it a challenge.
/varset NearestMobID ${NearestSpawn[1,npc targetable radius 200 zradius 50].ID}
} else {
/varset NearestMobID ${Target.ID}
}
/if (${NearestMobID}) {
/if (!${IgnoreList.Find[${Spawn[id ${NearestMobID}].CleanName}]}) {
/target id ${NearestMobID}
} else {
/continue
}
/target id ${NearestMobID}
| Rusang: Wait up until 2s for your Target's ID to match the one you want, but wait less if it happens earlier.
| AN: Also added buffspopulated.
/delay 2s ${Target.ID}==${NearestMobID} && ${Target.BuffsPopulated}
/delay 5
/if (${Target.ID}) {
/echo Attacking ${Target.CleanName}
/pet attack
/pet swarm
/delay 2s ${Pet.Target.ID}==${Target.ID}
} else {
/continue
}
| Kill! Loop
/while (1) {
/if (!${Me.Pet.ID}) {
/echo Your pet died a noble death. /sad Oh. here comes the mob.
/endmacro
}
/if (!${Spawn[id ${NearestMobID}].ID} || ${Spawn[id ${NearestMobID}].Type.Equal[Corpse]}) {
/echo Killed it!
| If still fighting, leave him in the loop, otherwise, exit
/if (!${Pet.Combat}) /break
}
/if (!${Pet.Target.ID}) {
/echo Pet has nothing targeted bringing it back.
/pet back off
/break
}
/delay 5
}
| Combat over. Change delay to your liking to allow recovery.
/delay 5
}
| No need for the search loop to go too fast.
/delay 5
}
:OnExit
/echo petbot.mac ended
/return