Generic Waypoint Script

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

Scary_Penguin
a lesser mummy
a lesser mummy
Posts: 76
Joined: Sun Nov 16, 2003 11:45 am

Generic Waypoint Script

Post by Scary_Penguin » Fri Dec 05, 2003 5:19 pm

Im trying to get a generic sub that I can insert into different macros and adjust accordingly, that has a series of waypoints I could have a character walk through, complete something, and return to their original point.

I was talking to GrimJack in IRC and he gave me this bit of code, but I have no idea how to implement it, or how/where i would set my waypoints.

Code: Select all

Sub MoveToLoc
    /if "$defined(Param0)"=="FALSE" /return
    /if "$defined(Param1)"=="FALSE" /return
    :LocMoveLoop
    /if "$char(state)"=="SIT" /stand
    /face nolook loc @Param0,@Param1
    /if n $distance(@AnchorX,@AnchorY)>5 /sendkey down up
    /if n $distance(@AnchorX,@AnchorY)<=5 {
       /sendkey up up
       /if "$char(state)"=="SIT" /stand
       /return
    }
    /goto :LocMoveLoop
/return

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

Post by grimjack » Sat Dec 06, 2003 9:11 am

Code: Select all

Sub MoveToLoc
    /if "$defined(Param0)"=="FALSE" /return
    /if "$defined(Param1)"=="FALSE" /return
    :LocMoveLoop
    /if "$char(state)"=="SIT" /stand
    /face nolook loc @Param0,@Param1
    /if n $distance(@Param0,@Param1)>5 /sendkey down up
    /if n $distance(@Param0,@Param1)<=5 {
       /sendkey up up
       /if "$char(state)"=="SIT" /stand
       /return
    }
    /goto :LocMoveLoop
/return
With this code you can /call MoveToLoc x y.

Lets say you want to hit (10 50),(20 53),(23 102) to get to the vendor and reverse to get back.

Sub MoveToVendor
/call MoveToLoc 10 50
/call MoveToLoc 20 53
/call MoveToLoc 23 102
/return

Sub MoveToWater
/call MoveToLoc 23 102
/call MoveToLoc 20 53
/call MoveToLoc 10 50
/return


In your main loop you would have a check of some sort to fire off the subs.

Thanks
GrimJack
When they come to me, they're in trouble, or they want some. I bust people out of prison, hunt down vampires, fight alien gods -- All the fun jobs people are too squeamish or too polite to do themselves.

Call me a mercenary. Call me an assassin. Call me a villain. I am all that and more.

My name's John Gaunt, but out on the streets of Cynosure, I am called...
GrimJack

Scary_Penguin
a lesser mummy
a lesser mummy
Posts: 76
Joined: Sun Nov 16, 2003 11:45 am

Post by Scary_Penguin » Sat Dec 06, 2003 3:24 pm

Great, thanks Grim, Ill give this a try.