Jump to content

Easy walking with TilePaths


H0ppy
 Share

Recommended Posts

Hello,

 

I've made a TilePath class very fast to walk some distances by walking on tilepaths:

CODE:

import org.osbot.script.Script;
import org.osbot.script.rs2.map.Position;

public class TilePath {

     private Script script;
     private Position[] path;
     private int[] distance;

    public TilePath(Script s, Position[] pos) {
         script = s;
         path = pos;
         distance = new int[path.length];
    }

     public void traverse() throws InterruptedException {
          initPath();
          script.walk(getNextPos());
     }

     private Position getNextPos() {
          Position pos = null;
          for (int i = (path.length - 1); i >= 0; i++) {
               if (distance[i] < 15) {
                    return path[i];
               }
          }
    return pos;
    }

     private void initPath() {
         for (int i = 0; i < path.length; i++) {
              distance[i] = script.realDistance(path[i]);
         }
     }
}

 

So now you can easy do:

Position[] testpath = {new Position(3012,3357,0),new Position(3007,3354,0),new Position(3007,3331,0)};
TilePath path = new TilePath(this, testpath);
path.traverse();

Pretty easy to use and its walks very smooth.

Kind regards
H0ppy

 

Edited by H0ppy
Link to comment
Share on other sites

So your other code was generated?

generated from where? some AI robot I made?

what a question ...

No i copied a piece of it and manaully typed the last part becaus ei didn't copied it whole by accident...

wow man. Like you never make mistakes ...

You so hostile.

Just because i turned down your offer to make tutorials together?

grtz

hoppy

Edited by H0ppy
Link to comment
Share on other sites

generated from where? some AI robot I made?

what a question ...

No i copied a piece of it and manaully typed the last part becaus ei didn't copied it whole by accident...

wow man. Like you never make mistakes ...

You so hostile.

Just because i turned down your offer to make tutorials together?

grtz

hoppy

Could you explain to me how to add this into my script, because this walking is killing me -.-"

Link to comment
Share on other sites

The code inside the spoiler is a class.
Just make a new class inside your IDE and paste that code in it.

Then in your main class you can create an object of it.
Like the example above.

Also check this thread: (good walking)
http://osbot.org/forum/topic/6283-aio-walking-class-doenst-glitch-on-break/
 

grtz
H0ppy
 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...