Arrays for Path Finding

Help section from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

RADCODE
orc pawn
orc pawn
Posts: 10
Joined: Thu Sep 05, 2002 6:34 pm

Arrays for Path Finding

Post by RADCODE » Sat Sep 07, 2002 6:37 am

I'm working on a Macro where I want to setup if possible, table of coordinates possibly but not neccesary in seperate file from which I want to read values on demand, sumular to this
Hop | X | Y | Z
------------------------
1, -100, 250, 25
2, -115, 255, 22
3, -125, 265, 23
4, -121, 253, 17
What I am trying to do is set a destination path from point 1 to point 4 or n and have character run the path through those specific coordinates. But in between each nop I wand to do other things, such as agro check, health check, return to previous hop after agro chase e.t.c. So I am wondering if it's possible to have this arranged somehow? Or perhapse another way to do this? The main loop would look something like this.

Sub Main

:mainloop
/call chkHealth
/call chkAgro
/varadd p1 | where p1 keeps track of current Hop
/call getNext_Loc $p1, $x,$y,$z
/call gotoloc $X,$Y
/call mainloop

/return

And I do need Z coordinate also to do check for overlapping path routes. This is for multilayered pathing where you can walk over on the bridge crossing possible match coordinates under it. And if you run off the path this would be the best way to return to closes path point and continue from there. Any sugestions on how to solver this would be greatly appretiated.

User avatar
L124RD
Site Admin
Site Admin
Posts: 1343
Joined: Fri Jun 14, 2002 12:15 am
Location: Cyberspace
Contact:

Post by L124RD » Sat Sep 07, 2002 1:35 pm

Salutations,
Here is a macro i wrote, edited for the combat thing you wanted. Enjoy.

Code: Select all

| -     Walk.inc     -  
|--------------------
|
| Useable in many macros, use
|  #include walk.inc
| to include the macro then
|  /call walk <#> <&> [@] 
| so the macro will follow that path
|   (# needs to be between 50 and 99)
|   loops through a(#,_), going to each
|   loc in turn. if @ is set to 1, it
|   will follow this path backwards.
|   & is the number of pieces there are
|   (IE in the example below, it is 5)
|     /varset a(50,0) 63,1723
|     /varset a(50,1) 80,1566
|     /varset a(50,2) 238,1571
|     /varset a(50,3) 239,1772
|     /varset a(50,4) 65,1770
|     /varset a(50,5) 63,1723
|     /call Walk 50 5 0
|     /call Walk 50 5 1
|
| Authors : L124RD
|---------------------
|
|***********************************************************

sub walk
 /varset a(5,0) $p0
 /varset a(5,1) $p1
 /varset a(5,2) $p2
 /cleanup
 /press i
 /if n $a(5,1)==1 {
  /face loc $a($a(5,0),$a(5,2))
  /varset p0 $a(5,2)
 } else {
  /face loc $a($a(5,0),0)
 /varset p0 0
 }
 /sendkey down up
 :WalkBigLoop
  /varset a(5,3) $rand(5)
  :WalkLoop
   /if $target()==TRUE {
    | Edit following line with what to do in combat
    /echo You have entered combat good sir/ma'am
   }
   /face loc $a($a(5,0),$p0)
   /if n $distance($a($a(5,0),$p0))>$a(5,3) /goto :WalkLoop
 /if "$a(5,1)"=="1" {
  /varsub p0 1
 } else {
  /varadd p0 1
 }
 /if n $p0!=$calc($a(5,2)+1) /if n $p0!=-1 /goto :WalkBigLoop
 /sendkey up up
/return

RADCODE
orc pawn
orc pawn
Posts: 10
Joined: Thu Sep 05, 2002 6:34 pm

Post by RADCODE » Sun Sep 08, 2002 2:05 pm

Ahh, thanks. Appretiate it.