goto.mac - moves you to position Y,X by: /macro goto Y X

Macro depository for macros written before the user variable changes that broke all of them.

Moderator: MacroQuest Developers

Nerfy
a lesser mummy
a lesser mummy
Posts: 72
Joined: Tue Oct 15, 2002 11:37 am

goto.mac - moves you to position Y,X by: /macro goto Y X

Post by Nerfy » Sat Oct 19, 2002 8:16 pm

Saw a request for this in the Help forum, I made it by copy, pasting, and rearranging Fippys code from Hunter.mac. It takes two points (Y,X) and will move you there. Well, close to there anyway.

Code: Select all

| goto.mac
|
| Usage: /macro goto X, Y
|
| By Nerfy who copy and pasted code from
| Fippy's Hunter.mac

#define Xpos $p1 
#define Ypos $p2 
#define Xcur v51 
#define Ycur v52 
#define ThereYet v53

Sub Main 

  /press esc 
  /press esc 
  /press esc 
  /press esc 
  /press alt 
  /press shift 
  /press ctrl

  :GoToPoint 
	/varset ThereYet 0
	/face loc $Ypos,$Xpos 
          
         | If we are not within melee range then make sure we are on autorun 
         /if n $distance($Ypos,$Xpos)>15 /call Autorun 1 

         | Current Loc
         /varset Xcur $char(x) 
         /varset Ycur $char(y) 

         | Obstacle routine if stuck
         /delay 1 
         /if n $MyXLoc==$char(x) /if $MyYLoc==$char(y) /call Obstacle 
          
         | End movement when near to point.
         /if n $distance($Ypos,$Xpos)<5 { 
            /call Autorun 0 
            /varset ThereYet 1 
         } 
            
          /delay 0 
   /if n $ThereYet!=1 /goto :GoToPoint 
   /echo Here we are.
/return
  

sub Obstacle 

   | We appear to be stuck so try and backup and strafe sideways 
   /sendkey up up 
   /sendkey down down 
   /delay 2 
   /sendkey up down 
   /sendkey down ctrl 
   /if n $rand(99)>50 { 
      /sendkey down right 
   } else { 
      /sendkey down left 
   } 
   /delay 3 
   /sendkey up right 
   /sendkey up left 
   /sendkey up ctrl 
   /sendkey down up 
/return 

Sub AutoRun
   /if $p0==1 /sendkey down up 
   /if $p0==0 /sendkey up up 
/return 

Last edited by Nerfy on Sun Oct 27, 2002 1:24 pm, edited 1 time in total.
----------
* Nerfy *

User avatar
RPZip
a lesser mummy
a lesser mummy
Posts: 63
Joined: Sun Aug 11, 2002 11:31 pm

Post by RPZip » Sat Oct 19, 2002 8:21 pm

Looks good, but the way you wrote it it looks like it won't re-/face the loc.

Digitalxero
a ghoul
a ghoul
Posts: 129
Joined: Tue Sep 10, 2002 5:01 pm

Post by Digitalxero » Sun Oct 27, 2002 10:43 am

if you change sub main to sub goto could you include this in a diff macro and use it like

Code: Select all

#include goto.mac

Sub Main

|I want to follow this Path
/call goto 145 1500
/delay 1
/call goto 367 1900
/delay 1
/call goto 690 1900
Just wondering if it would work like that