Jump to content

Easy walking with TilePaths


Recommended Posts

Posted (edited)

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
Posted (edited)

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
Posted

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 -.-"

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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