pull.mac [Request Fulfilled]

Macro requests from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

Wendel
a lesser mummy
a lesser mummy
Posts: 58
Joined: Wed Jul 24, 2002 1:48 am

pull.mac [Request Fulfilled]

Post by Wendel » Wed Jul 24, 2002 1:56 am

I'm looking for some help with a macro that will do the following.

Start at pos x,y
Find a Mob that's blue
Go and agro the mob
Return to Pos x,y
Fight the mob

on command he will pull again

I've got my macro working that he will start, and find a mob, but when it's time to bring it back he just fights the mob where he is(very dangerous for him) I can't snare it or dot it from far away.

Wendel

Wendel
a lesser mummy
a lesser mummy
Posts: 58
Joined: Wed Jul 24, 2002 1:48 am

Guess I should post this

Post by Wendel » Thu Jul 25, 2002 11:06 pm

Code: Select all

| - Pull.mac -
| Semi-intelligent
| With pulling!
|
|
#include routines.mac
#define HomeLoc "1792,993"

Sub Main
   /mqlog calling SelectTarget
   /call SelectTarget
   /call RunToMob
   /mqlog calling GoToLoc
   /call GoToLoc
   /mqlog waiting 5 seconds for mob to arive
   /face nopredict
   /delay 3s
   /mqlog calling AttackAndFollow
   /call AttackAndFollow
/return

Sub RunToMob
   /mqlog Starting RunToMob
   /varset v90 $target(id)
   /mqlog Going after $target(id)
   /delay 1
   /attack on
   /varset t0 4m
   
   :CloserAF
      /if "$target(id)"!="$v90" /goto :EndAF
      /face nopredict
      /if n $char(hp,pct)<95 /return
      /if n $target(distance)>16 /sendkey down up
      /if n $target(distance)<7 /sendkey down down
      /if n $target(distance)<17 /sendkey up up
      /if n $target(distance)>6 /sendkey up down
      /if n $t0==0 /press esc
      /if "$combat"!="TRUE" /goto :EndAF
   /goto :CloserAF
   
   :EndAF
      /sendkey up up
      /sendkey up down
      /attack off
/return

Sub GoToLoc
   /mqlog Starting Sub GoToLoc
   /mqlog "You are away from the guard, Running toward him..."
   /mqlog Character to far away from the guard... running back to his vicinity...
   /sendkey down up
   :gohomeloop
   /face loc 1792,993
   /if n $distance(1792,993)>12 /goto :gohomeloop
   /sendkey up up
/return

Sub AttackAndFollow
   /varset v90 $target(id)
   /mqlog attacking $target(name)...
   /delay 1
   /mqlog we just delayed 1
   /attack on
   /mqlog just turned attack on
   /varset t0 4m
   /mqlog set t0 to 4m
   
   :CloserAF
      /if "$target(id)"!="$v90" /goto :EndAF
      /face nopredict
      /mqlog faced our target
      /if n $target(distance)>16 /sendkey down up
      /if n $target(distance)<7 /sendkey down down
      /if n $target(distance)<17 /sendkey up up
      /if n $target(distance)>6 /sendkey up down
      /if n $t0==0 /press esc
      /if "$combat"!="TRUE" /goto :EndAF
   /goto :CloserAF
   
   :EndAF
      /mqlog ending AF
      /sendkey up up
      /sendkey up down
      /attack off
/return

Sub SelectTarget
   /press esc
   /mqlog Starting Sub SelectTarget
   /target npc range 40 50
/return

Sub AutoRun 
   /if $p0==$v80 /return 
   /varset v80 $p0 
   /if $p0==1 /sendkey down up 
   /if $p0==0 /sendkey up up 
/return 
What happens is he targets, runs to mob, fights it briefly to get some agro, runs back to his starting location, Sub AttackAndFollow is Called, then the script ends prematurly

Hoping someone can help me with this.. been banging my head a few days now
Last edited by Wendel on Fri Jul 26, 2002 2:36 pm, edited 1 time in total.

FlashG
Contributing Member
Contributing Member
Posts: 104
Joined: Thu Jul 11, 2002 6:38 pm

aggro

Post by FlashG » Fri Jul 26, 2002 10:55 am

Hey wendal, looks good. I may be missing it, but, I don't see where the you run to the target. I see a "Sub RunToMob" subroutine but not where its called. In the main I see where you target the mob, then call GotoLoc (which takes you back home). Where do you /call runto mob?

Please help the blind to see.

Wendel
a lesser mummy
a lesser mummy
Posts: 58
Joined: Wed Jul 24, 2002 1:48 am

Post by Wendel » Fri Jul 26, 2002 2:37 pm

I don't know how that got left out, I changed my post to reflect where it's called from

Wendel

icon-

Post by icon- » Sat Jul 27, 2002 3:57 am

Wendel, try changing the following:

Code: Select all

#define Homeloc "1792,993"

to

#define Homelocx $v95
#define Homelocy $v96
(inside Sub Main)
/varset v95 1792
/varset v96 993
Then inside Sub GoToLoc change:

Code: Select all

/face loc 1792,993

to

/face loc $v95,$v96
and
/if n $distance($v95,v$96)>12 /goto :gohomeloop
It's not much of a change really, just nitpicking, but this way, when you get your macro working, instead of hardcoding the homeloc into the macro, you can change the macro to take in the homeloc by running "/mac pull x y" by simply changing the /varset v95 # and /varset v96 # to /varset v95 $p0 and /varset v96 $p1 or something. I'm not that good of a macro author so my actual code might be way off but the idea is sound.

Give me some time to go through your macro with the readme file open (to check my own syntax on my ideas) and I will see what I can come up with.

- icon

eq_freak
a ghoul
a ghoul
Posts: 105
Joined: Mon Jun 24, 2002 7:17 am

Post by eq_freak » Sun Jul 28, 2002 8:42 pm

What exactly do you mean with "Sub AttackAndFollow is Called, then the script ends prematurly"?

Does he kill the mob? Or does he path around funny, or does the 4 min timer you have run out before he is done with kill or what?

If nothing else, for pure debug purposes you could do:

Code: Select all

  
 :CloserAF 
      /if "$target(id)"!="$v90" /echo No target - exitting
      /if "$target(id)"!="$v90" /goto :EndAF 
      /face nopredict 
      /mqlog faced our target 
      /if n $target(distance)>16 /sendkey down up 
      /if n $target(distance)<7 /sendkey down down 
      /if n $target(distance)<17 /sendkey up up 
      /if n $target(distance)>6 /sendkey up down 
      /if n $t0==0 /press esc 
      /if "$combat"!="TRUE" /echo Not fighting - exitting
      /if "$combat"!="TRUE" /goto :EndAF 
   /goto :CloserAF 
Then at least you would know which codepath the problem lies in, by looking at the /echo output.