• 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 --->

Macro - how does one make a macro that repeats 3 simple commands? (1 Viewer)

Joined
Dec 29, 2020
RedCents
52¢
ok so I want a hunter macro that will repeat: /tar <mob name>; /nav target; kill. can someone who is savy to code help me out here? (I'm completely code illiterate but a quick study)

(Or a link to a macro that someone has made that does this)
 
ok so I want a hunter macro that will repeat: /tar <mob name>; /nav target; kill. can someone who is savy to code help me out here? (I'm completely code illiterate but a quick study)

This untested, poo-code, might a start

INI:
Sub Main
    /delcare mobname string local "Mob Name Goes Here"

    /while (1) {
        /if (${Spawn[npc ${mobname}}) {
            /nav npc ${mobname}
            /delay 3s ${Navigation.Active}
            /while (${Navigation.Active}) {
                /if (${Spawn[npc ${mobname}].Distance3D} > 15) {
                    /delay 5
                } else {
                    /break
                }
            }
            /if (${Spawn[npc ${mobname}]} < 15) {
                /call Attack   
            }
        }
    }
/return

Sub Attack
    if (!${Me.Combat}) {
        /target npc ${mobname}
        /squelch /face fast
        /echo Attacking ${Target.Name}
        /squelch /attack on
    } else /if (${Target.Type.Equal[corpse]}) {
        /echo Target is a corpse, Clearing our target.
        /target clear
    }   
/return

in reality if you're going to expand it, you're going to want to have a bunch more "checking" stuff in there.

is my target the target i want to be looking it?
do i only want a certain radius
do i want to stop at any time, mana, group death, endurance, health, etc
do I want to do anything else? plugins loaded, safety type stuff, pull with something instead of just smack it - what if im stuck etc.

@kaen01 has >>> PocketFarm <<< which should handle all that stuff, and allow you to /pkf pull "skeleton" and most certainly better than the un-tested snip i threw up
 
I dug this up from something I used during TS farming days. Totally unprofessional and I would not present it as remotely production-ready code. There is some goofy stuff in there, and some 'wrong' stuff too. But for minimal effort, it has successfully run for hours killing specific mobs for me.

Just list the mobs you want to kill on the command line, e.g. "/mac hunt spider hatchling" and it will take care of the rest.

I have another version that stops to dispatch mobs that aggro while navigating, but this version works well enough for lowbie zones where they die from your DS anyway.

INI:
Sub Main

  /declare index  int     inner
  /declare mobs_to_hunt[20]   string  outer
  /declare mobs_to_hunt_count int     outer   0
  /declare closest_mob_id     int     inner
 
  /if (${Macro.Params}) {
    /for index 0 to ${Math.Calc[${Macro.Params}-1]}
      /if (${Defined[Param${index}]}) {
        /varcalc mobs_to_hunt_count ${mobs_to_hunt_count}+1
        /varset mobs_to_hunt[${mobs_to_hunt_count}] ${Param${index}}
      }
    /next index
  }

  /if (${mobs_to_hunt_count}) {
    /echo Hunting for the following mobs:
    /for index 1 to ${mobs_to_hunt_count}
      /echo ${mobs_to_hunt[${index}]}
    /next index
  } else {
    /echo No mobs specified, hunting all mobs.
  }
 
:get_next_mob

  /if (${mobs_to_hunt_count}) {
    /call FindClosestMob
    /varset closest_mob_id ${Macro.Return}
  } else {
    /varset closest_mob_id ${NearestSpawn[npc targetable noalert 1].ID}
  }

  /if (${closest_mob_id}==0) /goto :wait_for_mob
 
  /echo Going to kill ${closest_mob_id}

:get_to_mob

  /nav id ${closest_mob_id}
  /delay 2 ((${Nav.Active}==TRUE)
 
  /delay 120s (${Nav.Active}==FALSE)
  /echo OK, we should be there now...
 
  /target NPC id ${closest_mob_id}
  /delay 5 (${Target.ID})
  /if (${Target.ID}==NULL) {
    /echo Lost our target, getting another...
    /goto :get_next_mob
  }
  /attack on
  /pet attack
  /nav target
  /face
  /delay 120s (${Target.ID}==NULL)
 
  /goto :get_next_mob

  :wait_for_mob
    /delay 5s
    /goto :get_next_mob
}

/end

Sub FindClosestMob

  /declare index              int     local
  /declare mob_id             int     local
  /declare closest_mob_dist   float   local 100000
  /declare closest_mob_id     int     local 0

  /for index 1 to ${mobs_to_hunt_count}
    /call FindClosestMatchingMob ${mobs_to_hunt[${index}]}
    /varset mob_id ${Macro.Return}
    /if (${mob_id}) {
      /if (${Navigation.PathLength[id ${mob_id}]} < ${closest_mob_dist}) {
        /varset closest_mob_dist ${Navigation.PathLength[id ${mob_id}]}
        /varset closest_mob_id ${mob_id}
      }
    }
  /next index
/return ${closest_mob_id}

Sub FindClosestMatchingMob(string match)

  /declare mob_index int local
  /declare mob_count int local
  /declare mob_id int local
  /declare closest_mob_dist float local
  /declare closest_mob_id int local

  /varset mob_count ${SpawnCount[npc ${match} targetable noalert 1]}
  /echo There are ${mob_count} mobs matching ${match}

  /varset closest_mob_dist 100000
  /varset closest_mob_id 0
 
  /for mob_index 1 to ${mob_count}
    /varset mob_id ${NearestSpawn[${mob_index}, npc ${match} targetable noalert 1].ID}
    /if (${Navigation.PathExists[id ${mob_id}]}) {
      /if (${Navigation.PathLength[id ${mob_id}]} < ${closest_mob_dist}) {
        /varset closest_mob_dist ${Navigation.PathLength[id ${mob_id}]}
        /varset closest_mob_id ${mob_id}
      }
    }
  /next mob_index
 
  /if (${closest_mob_id}) {
    /echo I think the closest mob is ${closest_mob_id} @ ${closest_mob_dist}
  } else {
    /echo No mobs...
  }

/return ${closest_mob_id}
 
Macro - how does one make a macro that repeats 3 simple commands?

Users who are viewing this thread

Back
Top