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

Easy Bot v1.0 (Semi-afk) (1 Viewer)

WoopWoop

New member
Joined
Mar 11, 2013
RedCents
80¢
Hey guys. I just started writing macros for MQ2, and I wanted to post this simple semi-AFK bot that I wrote. I think it illustrates a bunch of useful functions that new macro writers can build off of. Basically, this bot is an AFK level 1 to 5 (It's currently configured for North Qeynos). Here is what it does:

  • Searches for a mob on the mob list
  • Attacks the mob
  • Loots the nearest corpse
  • Searches for a new mob

It doesn't pick up items, but thats not that big of a challenge and I may add it later. At the very least, I believe this code requires MQ2Melee and MQ2MoveUtils. Anyway, here is the code: (If you like this script, please consider sending a few cents my way. Thanks!)

EDIT: I forgot to mention that some of the functions (health checking and retreat) are not functional. I figured that retreating makes no sense when you don't lose EXP. Still I left them in for others to use as inspiration.

Rich (BB code):
|------------------------------------------------------------|
|	EASY BOT v1.0 (Levels 1 to 5)			 |	 
|								  	 |
|	By: WoopWoop (3/12/13)				 |
|------------------------------------------------------------|

|------------------------------------------------------------|
|		    Includes
|------------------------------------------------------------|

#turbo

|------------------------------------------------------------| 
|          Events 
|------------------------------------------------------------| 

#Event MobDeath "#*#You gain experience!!#*#" 
#Event Death "You have entered#*#"
#Event Death "You have been slain#*#"  
#Event KnockOut "You have been knocked unconscious!#*#"

|------------------------------------------------------------| 
|          Declares
|------------------------------------------------------------| 

Sub Declares

	|---- Health Check and Retreat Locs ----|
	
	/declare RetreatLoc[2] string outter 
	
	/varset RetreatLoc[1] 299  |-- X Loc
	/varset RetreatLoc[2] 118  |-- Y Loc
	
										   
	|---- End Health Check / Retreat Locs ----|
	
	/declare MobKillCount int outer 0 
	/declare RankCount	int outer 1
	/declare LastLocX int outer 956
	/declare LastLocY int outer 79
	
	|---- Target Aquisition Variables ----|
   
        /declare NoMobs int outer 0
        /declare Counter int outer 
        /declare CurrentMobID int outer
        /declare FirstMobID int outer
   
	/declare MobArray[5] string outer
	
	|---- End Target Aquisition Variables----|
		
	|---- Kill Rankings ----|
	
	/declare MobKillRank[10] string outer
	
	/varset MobKillRank[1] "A Naughty Noob"
	/varset MobKillRank[2] "A Big Boy Bat"
	/varset MobKillRank[3] "A Silly Skeleton"
	/varset MobKillRank[4] "A Booger Burglar "
	/varset MobKillRank[5] "A Wacky Weasel"
	/varset MobKillRank[6] "Sassy Classy Clown"
	/varset MobKillRank[7] "Mega Master Man
	/varset MobKillRank[8] "Insane Brain!"
	/varset MobKillRank[9] "M-M-M-Monster!"
	/varset MobKillRank[10] "!!GODLIKE!!"
	
	|---- End Kill Rankings ----|
	
/return

Sub MobList

|** This is a Mob List that you can edit to determine which mobs you attack. 
	Note that the current MobArray is set only to handle 5 unique mobs	 **|

	/varset MobArray[1] "a bat"
	/varset MobArray[2] "a decaying skeleton"
	/varset MobArray[3] "a decaying skeleton"
	/varset MobArray[4] "a large rat"
	/varset MobArray[5] "a grass snake"
	
/return

Sub MobListPlus

|** This is the Advanced (lvl 3-4) Mob List that you can edit to determine which mobs you attack. 
	Note that the current MobArray is set only to handle 5 unique mobs	 **|
	
	/varset MobArray[1] "a bat"
	/varset MobArray[2] "a klicnik worker"
	/varset MobArray[3] "a decaying skeleton"
	/varset MobArray[4] "a large rat"
	/varset MobArray[5] "a grass snake"
	
/return

	

|------------------------------------------------------------| 
|        	Main Routine
|------------------------------------------------------------| 

Sub Main
	/declare tempLevel int local 	
	/call Declares
	/echo Easy Bot v. 1.0 - Good Luck!
			
	:MainLoop
		/doevents
		
		|--- Check Level Function ---|
		
		
		/varset tempLevel ${Me.Level}
				
		/if (${Math.Calc[${tempLevel}<3]} == 1.00) {
			/call MobList  
		} else {
			/call MobListPlus 
		}
		
		|--- Check Level Function ---|		
		
		/call AcquireTarget  
		
		|--- Check Health Function ---|
		/if (${Me.PctHPs}<35) {
			/varset LastLocX ${Me.X}
			/varset LastLocY ${Me.Y}     
		} 
		|--- Check Health Function ---|
		
		/if (${Me.Combat}) {
		
		/echo I'm slaying these jerks!
		
		} else { 
		
			/target corpse radius 17
			/delay 1s
			/loot
			/delay 3s
			/notify LootWnd DoneButton leftmouseup 
		    /delay 1s
		
		}
		
		
		/delay 1
		/goto :MainLoop

/return


|------------------------------------------------------------| 
|          Attack Rountines 
|------------------------------------------------------------| 

Sub AttackNow
    
    /if (${Me.PctHPs}>35) {
    /popup Now Attacking: ${Target}!
    /stick 10
	} else {
		/goto :EndofAttack
	
	}
		
	/if (${Target.Type.Equal[NPC]} && ${Me.PctHPs}<35) { 
		/stick off
			/attack off
			/varset LastLocX ${Me.X}
			/varset LastLocY ${Me.Y} 
						
	} else {
			:AttackLoop
				/if (${Target.Type.Equal[NPC]}) {		
					/doevents
					/attack on
					/Delay 5s									 
					/goto :AttackLoop
				} 

	}
	:EndofAttack

/return

|------------------------------------------------------------| 
|         Target Acquisition Routines
|------------------------------------------------------------| 

Sub AcquireTarget
   
   /doevents
   
   /squelch /echo Aquiring Targets |-- For Testing purposes
   
   /varset FirstMobID ${Me.NearestSpawn[1,npc ${MobArray[1]}].ID}
   
   /for Counter 1 to 5
         
      /varset CurrentMobID ${Me.NearestSpawn[1,npc ${MobArray[${Counter}]}].ID}

      /if (${Spawn[${CurrentMobID}].Distance}<${Spawn[${FirstMobID}].Distance} && ${Bool[${CurrentMobID}]}) {
         
         /delay 1s
         /varset FirstMobID ${CurrentMobID}
      
      }
   /next Counter
   
   /if (${Spawn[${FirstMobID}].Distance} < 150 && ${Bool[${FirstMobID}]}) {
   		/delay 1s
   		/target ${Spawn[${FirstMobID}].Name}
   		/echo Target Acquired: ${Target}
   		/delay 1s
		/call AttackNow
   	} else {
   		/squelch /echo Nothing in Range |-- For Testing purposes
   		/delay 5s
   	}

/return

|------------------------------------------------------------| 
|          Health Check Rountines 
|------------------------------------------------------------| 

|** These are unused ideas that I had for the macro, but I decided
to keep them included just to give people ideas**|

Sub CheckHealth 
	
	/if (${Me.PctHPs}<35) { 
			/MoveTo loc ${RetreatLoc[1]} ${RetreatLoc[2]}
			/delay 1
	} 
	
	:MovingLoop
		/if (${MoveTo.Moving}) {
			/delay 2s
			/doevents
			/goto :MovingLoop
		}
	/call WaitTilHealed
/return 

Sub WaitTilHealed
	/echo Waiting to heal up
	:LoopTilHealed
		/if (${Me.PctHPs}<100) { 
			/docommand ${If[${Me.Standing},/sit,/echo I am not sitting down]}
			/delay 10s
			/doevents
			/goto :LoopTilHealed
		}
	
	/MoveTo loc ${LastLocY} ${LastLocX}
		:MovingLoop
		/if (${MoveTo.Moving} && !${Me.Combat}) {
			/delay 2s
			/doevents
			/goto :MovingLoop
		}
/return


|------------------------------------------------------------| 
|        Events 
|------------------------------------------------------------| 

|** I put this in just for fun. If you want a kill count update, 
just remove the squelch **|

Sub Event_MobDeath 

/varset MobKillCount ${Math.Calc[${MobKillCount}+1]} 
/squelch /echo You've Slain: ${MobKillCount} mobs!
/squelch /echo Your Rank: ${MobKillRank[${RankCount}]}

/return 

|------------------------------------------------------------|
|		Death 
|------------------------------------------------------------|

Sub MobKillRank
	/declare MobKillCounter int local 1
	/declare Sum1 int local 0
	/declare Sum2 int local 0
	/varset RankCount 1
			
	/for MobKillCounter 1 to 10
		/varset Sum1 ${Math.Calc[${MobKillCounter}*5]}
		/varset Sum2 ${MobKillCount}
				
	
		/if (${Sum1}<${Sum2}) {
			/varset RankCount ${MobKillCounter}	
		}		
	/next MobKillCounter
	
/return 

Sub Event_KnockOut
	
	/varset LastLocX ${Me.X}
	/varset LastLocY ${Me.Y} 
	
	/echo ============================================
	/echo You've Been Knocked Out!
	/echo Location: ${Me.Y},${Me.X} 
	/echo You've Been Knocked Out!
	/echo ============================================

/return


Sub Event_Death

	/call MobKillRank
	/echo ============================================
	/echo You Have Died!
	/echo Your Corpse Location: ${Me.Y},${Me.X} (most likely)
	/echo You managed to kill ${MobKillCount} mobs!
	/Echo Your Rank: ${MobKillRank[${RankCount}]}
	/echo You Have Died!
	/echo ============================================
	
	/endmacro
/return

P.S. Enjoy the kill ranking :D
 
Last edited:
Easy Bot v1.0 (Semi-afk)

Users who are viewing this thread

Back
Top