Beastlord Autopull

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

SlimFastForYou
a hill giant
a hill giant
Posts: 174
Joined: Sat Jan 24, 2004 1:38 am

Beastlord Autopull

Post by SlimFastForYou » Sat Mar 06, 2004 4:34 pm

I had been wanting an autopull macro, and I couldn't find anything near what I was looking for (something which would dodge obstacles, send the cleric a /tell asking if ready for a pull, etc).

This ISN'T GOLD CODE BY ANY MEANS. This is sorta beta. I wouldnt recommend leaving your game unattended for more than 15 minutes (record time without screwing up is little over 3 hours). When I update the code, I will post the updates on this thread.

So here is the feature list:
- Pulls one of two different kinds of mob (whichever closer) (you specify)
- Obstacle dodging (you have to get used to it)
- Auto-Autoattack (you kick, follow mob, etc)
- Auto-SoW casting
- Auto-Pet and Pet Proc casting
- Anti-add (there are problems with the logic and I need to overhaul). At the end of my post I will show an image of how it works.

(the camp when killed is broken at this point in time)

Quick warning: I cleaned up some of the code and took out static references and replaced them with variable-based references (so you only need to change things in one spot). I haven't tested the code yet, but if you find problems with the execution reply to this thread and let me know =).

The code:

Code: Select all

| Usage:  /macro blpull <clericname>
| Originally designed for beastlords in their mid-30s
|
| Note:  Your Home Location (anchor) is the loc you start
| the macro from.  So.. position yourself accordingly before
| running.
|
| DANGER, DANGER WILL ROBINSON!!!  This WILL send text to
| chat chan #1 AND group.  This will also send automated
| tells to your cleric every so many seconds asking if
| ready for pull (rfp).  You have been warned...
|
| Currently only pulls the closest of two different mob names
| This is by no means the final version however since I wished
| for an automatic pull macro, and this is the best one I know
| of (at least for my purposes), 
| 
| Code shamelessly stolen from all over.  I did come up with
| the obstacle-dodging routine though =).  Not sure how
| it might look to others in the group =).
|
| For best results, try with levitate and having been
| shrunk to the max
|
| There are some issues with the anti-add logic.
|
| FYI, script relies on mobs AGGROING.  This does not cast a
| spell on the mobs, only runs to them and runs back if they
| do not follow the first time.
|
| Please read the thread this was posted on for more details, especially
| about how the anti-add works so far.

#turbo
#chat tell
#event Fizzle "Your spell fizzles!"
#event Interrupted "Your spell is interrupted"
#event InfernoWearOff "Your pet's Spirit of Inferno"
#event SpellSuccess "You begin casting"
|||||||||||||||!!!!!!!CHANGE ME!!!!!!!!!!!!||||||||||||||
#define ENEMYTYPEA "rhino"
#define ENEMYTYPEB "underbulk"
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||

Sub Main
    /declare CheckIfMobHereTimer timer
    /declare WarderName global
    /declare WarderBuff global
    /declare aggrodistance global
    /declare varMobTypeA global
    /declare varMobTypeB global
|||||||||||||||||*******CHANGE ME********|||||||||||||||||
    /varset WarderName "Spirit of Herikol"
    /varset WarderBuff "Spirit of Inferno"
    /varset aggrodistance 100
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||


    /declare xhomeloc global
    /declare yhomeloc global
    /declare groupcleric global
    /varset xhomeloc $char(x)
    /varset yhomeloc $char(y)
    /varset groupcleric @Param0
    /echo MQ home loc set to @yhomeloc @xhomeloc
    /declare rfp global  
    /declare AskTimer timer
   :Loop
   /if n @AskTimer<=1   {
	/tell "@groupcleric" rfp
        /varset AskTimer 43s
}
   /varset rfp 0
   /doevents
   /if @rfp==0 /goto :loop
   /call CheckPet
   /varset rfp 1
   /attack off
   :Pull
   /call SelectTarget 
   /call RunToMob  
   /call GoToHomeLocation 
| The combat on <charname> is useful for other bots in your channel (especially
| ones with Xylobot who need combat casting mode on.  Comment it out if you
| don't like it.
   /1 combat on $char(name)
   /pet back off
   /face
   /delay 6s 
   /if n $target(distance)>100 /goto :Pull
   /call AttackAndFollow 
   /doevents flush
   /if n $distance(@yhomeloc,@xhomeloc)>50 /call GoToHomeLocation
   /press f1
   /if n $char(buff,"Spirit of Wolf")==0  /call Cast_Spirit_Of_Wolf
   /goto :Loop
/return 


|
| Messy, yes I know.  Live with it for now I guess =P
|
Sub RunToMob   
    /if n $target(id)==0 /return
    /echo In RunToMob
    /varset CheckIfMobHereTimer 6s
   :CloserAF   
      /if n @CheckIfMobHereTimer<=1s {
		/if n $distance(@yhomeloc,@xhomeloc)<=60 /return
	}
      /if n $target(distance)>$calc(@aggrodistance-5) /sendkey down up 
      /if n $target(distance)<$calc(@aggrodistance/3) /sendkey up up 
      /face fast
      /sendkey down right
      /delay 7 
      /sendkey up right 
      /if n $target(distance)<$calc(@aggrodistance/3) /return
      /face fast
      /if n $target(distance)<$calc(@aggrodistance/3) /return
      /delay 10
      /if n $target(distance)<$calc(@aggrodistance/3) /return
      /delay 10
      /if n $target(distance)<$calc(@aggrodistance/3) /return
      /delay 10
      /if n $target(distance)<$calc(@aggrodistance/3) /return
      /delay 10
      /if n $target(distance)<$calc(@aggrodistance/3) /return
      /sendkey down left
      /delay 7 
      /sendkey up left 
      /face fast
      /if n $target(distance)<$calc(@aggrodistance/2*3) /return
      /call SelectTarget
   /goto :CloserAF 
/return 

|
| Messy, yes I know.  Live with it for now I guess =P
|
Sub GoToHomeLocation 
   /if n $target(id)==0 /return
   /echo in GoToHomeLocation
   /sendkey down up 
   :gohomeloop 
    /face fast loc @yhomeloc, @xhomeloc
   /pet back off
   /delay 5
   /if n $distance(@yhomeloc,@xhomeloc)<25 /goto :DoneWithGoToLoc
   /delay 5
   /if n $distance(@yhomeloc,@xhomeloc)<25 /goto :DoneWithGoToLoc
   /delay 5
   /if n $distance(@yhomeloc,@xhomeloc)<25 /goto :DoneWithGoToLoc
   /delay 5
   /if n $distance(@yhomeloc,@xhomeloc)<25 /goto :DoneWithGoToLoc
   /delay 5
   /if n $distance(@yhomeloc,@xhomeloc)<25 /goto :DoneWithGoToLoc
   /delay 5
   /if n $distance(@yhomeloc,@xhomeloc)<25 /goto :DoneWithGoToLoc
   /delay 5
   /if n $distance(@yhomeloc,@xhomeloc)<25 /goto :DoneWithGoToLoc
   /sendkey down left
   /delay 7 
   /sendkey up left 
   /pet back off
   /if n $distance(@yhomeloc,@xhomeloc)<25 /goto :DoneWithGoToLoc
   /face fast loc @yhomeloc, @xhomeloc 
   /delay 5
   /if n $distance(@yhomeloc,@xhomeloc)<25 /goto :DoneWithGoToLoc
   /delay 5
   /if n $distance(@yhomeloc,@xhomeloc)<25 /goto :DoneWithGoToLoc
   /delay 5
   /pet back off
   /if n $distance(@yhomeloc,@xhomeloc)<25 /goto :DoneWithGoToLoc
   /sendkey down right
   /delay 7 
   /sendkey up right 
   /pet back off
   /face fast loc @yhomeloc, @xhomeloc
   /if n $distance(@yhomeloc,@xhomeloc)>25 /goto :gohomeloop 
   :DoneWithGoToLoc
   /sendkey up up 
/return 

Sub AttackAndFollow
/attack on
/delay 10s
/pet attack
:AttackLoop 
   /if n $target(distance)<18 /doability kick 
   /face fast 
   /if n $target(distance)>15 /sendkey down up      |If target is > 18 move forward 
   /if n $target(distance)<4  /sendkey down down    |If target is < 4 move back 
   /if n $target(distance)<10 /sendkey up up        |If target is < 10 stop moving fwd 
   /if n $target(distance)>10 /sendkey up down      |If target is > 12 stop moving back 
/if n "$target()"=="TRUE" /goto :AttackLoop
/sendkey up up
/sendkey up down
/return

Sub SelectTarget 
   /declare targetdistance local
   :SelectTarget
   /press esc 

   /target npc ENEMYTYPEA
   /varset targetdistance $target(distance)
   /target npc ENEMYTYPEB 
   /if "$target()"!="TRUE" /goto :SelectTarget
   /if n $target(distance)<@targetdistance {
   /g Pulling %t
   }
   /if n $target(distance)>=@targetdistance {
	/target npc ENEMYTYPEA
	/g pulling %t
}
   /varset targetdistance $target(distance)
   :losetarget
   /press esc
   /echo dropping target
   /if n $target(id)!=0 /goto :losetarget
   /target npc "ENEMYTYPEA" range $calc(@targetdistance+10) $calc(@targetdistance+101)
   /target npc "ENEMYTYPEB" range $calc(@targetdistance+10) $calc(@targetdistance+101)
   /if n $target(id)!=0  {
	/echo Found something in aggro range
	/delay 4s
        /g momentarily stopped to prevent adds.
	/if n $distance(@yhomeloc,@xhomeloc)<25 {
		/echo too close to home
		/press esc
		/return
	}
	/goto :SelectTarget
}
   /target npc ENEMYTYPEA
   /varset targetdistance $target(distance)
   /target npc ENEMYTYPEB 
   /if n $target(distance)>=@targetdistance {
	/target npc ENEMYTYPEA
   /echo selected closest target
}

/return 



Sub Cast_Spirit_Of_Wolf
{
   /declare spellstatus local
   /varset spellstatus 0 
   /if n $char(gem,"Spirit of Wolf")==0 /memspell 2 "Spirit of Wolf" 
   /delay 10 
   /target myself 
:CastingSoW
   /cast "Spirit of Wolf" 
   /delay 10 
   /doevents 
   /if n $char(buff,"Spirit of Wolf")!=0 {
	/varset spellstatus 1
	/return
   }
   /if n @spellstatus==0 /goto :CastingSoW 
/return
}


Sub Event_chat(ChatType,Sender,ChatText) 
|   /declare SenderVar local 
   /declare ChatTextVar local 
|   /varset SenderVar $lcase("@Sender") 
   /varset ChatTextVar "$lcase("@ChatText")" 
   /if "@ChatTextVar"=="hold" { 
	/varset rfp 0
} 

   /if "@ChatTextVar"=="ready" {
	/varset rfp 1
}
/return

Sub CheckPet
	/stand
	/press esc
	/if n $char(pet)==0 {
		/if n $char(gem,"@WarderName")==0 {
			/memspell 4 "@WarderName" 
  			/delay 8s
		}
		:castpet
		/cast "@WarderName"
		/doevents Fizzle
		/if "$return"=="cast_fizzle" /goto :castpet 
		/doevents Interrupted
		/if "$return"=="cast_interrupted" /goto :castpet 
		/delay 8s
		/pet guard
		/if n $char(gem,"@WarderBuff")==0 {
			/memspell 5 "@WarderBuff" 
  			/delay 8s
		}
		/call Event_InfernoWearOff
	}
/return

Sub Event_InfernoWearOff
	:castinferno
	/cast "@WarderBuff"
	/doevents
	/if "$return"=="spell_success" {
		/delay 8s
		/return
	}
	/goto :castinferno
/return

Sub Event_Interrupted
/return cast_interrupted

Sub Event_Fizzle 
/return cast_fizzle 

Sub Event_SpellSuccess
/return spell_success
This is a diagram of how the anti-add system works. In the near future I plan to have the anti-add system alert proximity based. I am not quite sure how to do this, but when I figure it out I will post.
Image

(last edited the code 3:32 pst 03/06/04 [fixed lots of run-time errors - sorry about that but didnt have a way of testing at the time])

cronic
a grimling bloodguard
a grimling bloodguard
Posts: 536
Joined: Wed Nov 26, 2003 11:01 pm

Post by cronic » Tue Mar 09, 2004 2:59 pm

I haven't gone over the code (or run the macro), but if it does what you say, then this is really (really) neat.

cheers

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Re: Beastlord Autopull

Post by Mckorr » Tue Mar 09, 2004 3:24 pm

SlimFastForYou wrote:I wouldnt recommend leaving your game unattended for more than 15 minutes (record time without screwing up is little over 3 hours). When I update the code, I will post the updates on this thread.
We actively discourage AFK macroing here. Comments like that are likely to get your code removed and your account banned. Please be more careful in the future.

As a warning, using any macro AFK is quite likely to get you banned. When it does (not IF), don't come cryin'.

SlimFastForYou
a hill giant
a hill giant
Posts: 174
Joined: Sat Jan 24, 2004 1:38 am

Post by SlimFastForYou » Thu Mar 11, 2004 10:44 pm

using any macro AFK is quite likely to get you banned. When it does (not IF), don't come cryin'.
Not wanting to start an endless debate, I propse that using ANY macro (irregardless of AFK) is quite likely to get you banned. I don't see why Sony couldn't tell if people /face-d or /target-ed across the map, etc. MQ is letting me have some fun once again with a game I probably otherwise would have stopped playing. If I get banned, I will wait for WoW.

Likewise, I also don't recommend AFK macroing. Whether with this (somewhat buggy) macro or with others. The reason I designed this was for people who like to multi-box (like myself). I found a macro for basically every role except the puller, and since I don't really care to pull I made this. As far as the "I don't recommend you going AFK for more than 15 minutes", I was thinking more along the lines of "your fine if you gotta piss but if you gotta shit you'll probably die".

If you think, Mckorr, that I shouldn't publish my updates to this code on this forum, I won't object. The one and only reason I decided to publish it in the first place was because I learned a lot from other published macros and thought I might give back to the community. If you think posting updates might do the community more harm than good, say so and I will not publish better versions of this. You know this community better than me, and I don't mind either way :).

[40oz]
a hill giant
a hill giant
Posts: 156
Joined: Tue Nov 12, 2002 12:14 pm

Post by [40oz] » Fri Mar 12, 2004 12:30 am

slimfast

i commend your efforts on a macro to auto pull.

A suggest looking towards a few ideas:

First, do not /target a mob unless you intend to kill it. You can avoid using this by harnessing the power of $searchspawn and $spawn. Take a look at these.

One macro you may want to look at for examples of code and specific routines relating to adds and target selection is the AdvChant by Raebis - maintained at the moment by braindozer. It's for bards, but it has a good target selection routine as well as mob avoidance (preliminary stages) and add detection (in quite an ingenious way I hadn't thought of).

Thanks for your outlook on this subject, it's not one that's on the boards too often and gave me a different perspective of how to go about it. I already see some ideas that are worth investigating for my own macros.

SlimFastForYou
a hill giant
a hill giant
Posts: 174
Joined: Sat Jan 24, 2004 1:38 am

Post by SlimFastForYou » Fri Mar 12, 2004 1:04 am

Thanks for the input 40oz.

I'll look into that on the weekend. I'm going to get the newest version of ShowEQ installed on this box, play with the map tools, and watch my current macro at work. If I have it draw circles around particular mobs, I can watch the mob pathing and sorta visualize how such an anti-add would work a bit better.

Also, currently the pathing of the character looks quite funky to other observing players. Currently, the character strafes every so many seconds. More accurately, the character runs forward for a while, makes a 135 degree turn, runs that direction for a second, then /face-s the home loc. So one of the things on my (growing) to do list is to have the macro figure out if the character is stuck on something (the loc isn't changing while it is in the GoToHomeLoc subroutine). That way, the character could then initiate the obstacle avoidance (thus not looking totally retarted whenever you pull).