• You've discovered RedGuides 📕 an EverQuest multi-boxing community 🛡️🧙🗡️. We want you to play several EQ characters at once, come join us and say hello! 👋
  • IS THIS SITE UGLY? Change the look. To dismiss this notice, click the X --->

Request - Simple macro help request (1 Viewer)

Rusang

Learner of Many Things
Joined
Apr 15, 2019
RedCents
1,333¢
I have zero skill to make macros. However, I would like to expand on what I typed out below (to the best of my ability, if I am doing it right at all).

My goal is to just sit on a spot with a pet class, and if any NPC is within XYZ radius (changeable, and I know pets have an attack range limit) then target it and send the pet to kill it. From there, nothing else needs to happen. I don't want to continue spamming /pet attack as shown below.

Is anyone willing to assist in writing this super basic macro?


INI:
    Sub Main

:Main
    /target NPC
    /delay 2s
    /pet attack
/delay 5s
/goto :Main
    /return
 
Something I whipped up for you:
| ------------------------------------------------------------------
| 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
 
Last edited:
@AmericanNero ,

Unfortunately, still struggling. I get the "attacking TARGET" and "pet has nothing targetted bringing it back" two lines spammed every few seconds.

I tried slowing it down by adding a "/delay 2s" on the line after "/pet swarm", then the message changed to spamming "Killed it!" over and over none-stop.

Greatly appreciate you taking the time to review!
 
A couple of techniques, looking at the code

INI:
/target id ${NearestMobID}
| Wait up until 2s for your Target's ID to match the one you want, but wait less if it happens earlier.
/delay 2s ${Target.ID}==${NearestMobID}

You can then use the technique to check if the pet acquires it's target, otherwise it may continue and evaluate the "pet has nothing targetted bringing it back" part before the pet's target is populated (server round trips = 10's of ms, macro evaluation 1's of ms)

INI:
/delay 2s ${Pet.Target.ID}==${NearestMobID}

The while loop could also have some of the conditionals rather than using (1), but I'm just not a fan of infinite loops.
 
When you get a lot of break conditions, it's impractical to place them there. We want the process to spin, which is a standard practice.

I prepared that as a starting point. Hope you find it useful.

Does it work? Updated a smidge.
 
Last edited:
Request - Simple macro help request

Users who are viewing this thread

Back
Top