Location Anchor w/ move-to

A forum for macro code snippets to be used in writing other macros. Post routines or .inc files here only, completed macros go to the Macro Depot.

Moderator: MacroQuest Developers

kirre
orc pawn
orc pawn
Posts: 16
Joined: Wed Dec 17, 2003 1:53 am

Location Anchor w/ move-to

Post by kirre » Sat Feb 07, 2004 6:11 am

Code: Select all

| Anchor.mac
| Yes the /echo for the OMW thing looks off, but its lined up in the MQ Window
| Can Not remember which script i Got MoveToAnchor from, but credits to the maker.
| Fair Warning This will Run you in a STRAIGHT line.

#turbo 50
#define AnchorX "####.##"	  	        | LOC for your Anchor Point X
#define AnchorY "####.##"	  	        | LOC for your Anchor Point Y

Sub Main
/echo -====================================-
/echo -=== On My Way to the Following Location: ===-
/echo -====================================-
/echo -============ X:[AnchorX] ==============-
/echo -============ Y:[AnchorY] ==============-
/echo -====================================-
/call MoveToAnchor
/endmacro

Sub MoveToAnchor 
 :AnchorMoveLoop 
  /if "$char(state)"=="SIT" /stand 
   /face nolook loc AnchorX,AnchorY
    /if n $distance(AnchorX,AnchorY)>11 /sendkey down up 
    /if n $distance(AnchorX,AnchorY)<=11 { 
     /sendkey up up 
      /return 
} 
 /goto :AnchorMoveLoop 

/return
 
Chow
Kirre

Glytch
a lesser mummy
a lesser mummy
Posts: 36
Joined: Sat Dec 27, 2003 9:22 am

Post by Glytch » Tue Mar 09, 2004 5:54 pm

im new to this and slowing understanding abotu programming. could you do this ? If you wanted your location to become your acnchor ? ofcourse you would have to target yourself. no flames please =P im just trying to learn some of these commands so i can stop leeching off the macro depot forums =P

Code: Select all

| Anchor.mac 
| Yes the /echo for the OMW thing looks off, but its lined up in the MQ Window 
| Can Not remember which script i Got MoveToAnchor from, but credits to the maker. 
| Fair Warning This will Run you in a STRAIGHT line. 

#turbo 50 
[color=red]#define AnchorX $target(x)
#define AnchorY $target(y)[/color]
Sub Main 
/echo -====================================- 
/echo -=== On My Way to the Following Location: ===- 
/echo -====================================- 
/echo -============ X:[AnchorX] ==============- 
/echo -============ Y:[AnchorY] ==============- 
/echo -====================================- 
/call MoveToAnchor 
/endmacro 

Sub MoveToAnchor 
:AnchorMoveLoop 
  /if "$char(state)"=="SIT" /stand 
   /face nolook loc AnchorX,AnchorY 
    /if n $distance(AnchorX,AnchorY)>11 /sendkey down up 
    /if n $distance(AnchorX,AnchorY)<=11 { 
     /sendkey up up 
      /return 
} 
/goto :AnchorMoveLoop 

/return 

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Tue Mar 09, 2004 7:40 pm

I took a few minutes and modified this to be a bit more useful. I changed it into an include and added a few commands that you can call to drop anchor and head to ancher from within your macros.

To drop anchor:
/echo drop anchor

To head to anchor after you've dropped one:
/echo goto anchor

You could also call the MoveToAnchor sub and use it like a "goto loc" command I suppose like this:

/call MoveToAnchor -100 1000

Note: I didn't test this but it should work. Let me know if I need to get off my ass and test it.

Code: Select all

|
| Anchor.inc
|

#Event DropAnchor "[MQ2] drop anchor"
#Event HeadToAnchor "[MQ2] goto anchor"

Sub MoveToAnchor(AnchorY,AnchorX) 
/echo -====================================- 
/echo -=== On My Way to the Following Location: ===- 
/echo -====================================- 
/echo -============ Y:[@AnchorY] ==============- 
/echo -============ X:[@AnchorX] ==============- 
/echo -====================================- 

:AnchorMoveLoop 
    /if "$char(state)"=="SIT" /stand 
    /face nolook loc @AnchorY,@AnchorX 
    /if n $distance(@AnchorY,@AnchorX)>11 /sendkey down up 
    /if n $distance(@AnchorY,@AnchorX)<=11 { 
        /sendkey up up 
        /return 
    } 
/goto :AnchorMoveLoop 
/return 

Sub Event_DropAnchor
/varset DropAnchorY $char(y)
/varset DropAnchorX $char(x)
/return

Sub Event_HeadToAnchor
/if "@DropAnchorY"!="NULL" /if "@DropAnchorX"!="NULL" {
    /call MoveToAnchor @AnchorY @AnchorX
} else {
    /echo There is no anchor currently defined.
}
/return

Sub InitAnchor
/declare DropAnchorY global
/declare DropAnchorX global
/varset DropAnchorY NULL
/varset DropAnchorX NULL
/return

Example of a calling Macro. You need to include the things marked in red in your macro.

Code: Select all

|
| ExampleCalling.mac
|

#turbo 50
[color=red]#include Anchor.inc[/color]

Sub Main
[color=red]/call InitAnchor[/color]

:MainLoop
/doevents
/delay 0
/goto :MainLoop

/return