• Hail, we're RedGuides. We want you to play six (yes, 6!) EverQuest characters at once. We have scripts and a friendly community to help, please join our playstyle and say hello! 👋
  • We've added LLM sections to our Terms & Rules and Resource Rules, for everyone's sanity & in-game safety.
    Read more
    a. Do not replace your voice with an LLM. This goes for your posts and your scripts. Drafting and editing with a tool is fine, but don't take you out of what you share.
    b. Do not replace your EQ character's voice with an LLM. We don't want scripts that speak over /ooc, /shout or other public channels. This has been an unwritten rule that's kept casino scripts off the site for decades, but we're now compelled to make it clear: keep automated communication private.

    Why Does RG Review Scripts?
    Nearly every LLM-written Lua script we see is making your character do impossible things, and rarely in a way that's beneficial to you. We've seen heavy server hammering, /target over impossible distances when /nav spawn would passively accomplish the same thing, a spawn search that fires 20+ times per second, and other pointless actions that are likely annoying GMs.

    You are welcome to use LLMs as a tool to structure, draft, and edit your work, but please read critically before hitting /lua run

Request - Simple macro help request

Rusang

Learner of Many Things
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
INI:
| ------------------------------------------------------------------
| 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

Code:
/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)

Code:
/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
Cart