Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Simple Walking

Featured Replies

This class is simple, yet effective walking. I use it in my private scripts and it has yet to fail me.



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

import java.awt.*;

public class Walk {

    private Script script;
    //static public Position[] Path;
    private int[] distance;


    public Walk(Script s) {
        script = s;
    }

    Position[] CreatePath(int[][] path) {
        Position[] returnpath = new Position[path.length];
        for(int i = 0; i < path.length; i++) {
            returnpath[i] = new Position(path[i][0], path[i][1], 0);
        }
        //Path = returnpath.clone();
        return returnpath;
    }

    static int current = 0;
    boolean getNext(Position[] Path, boolean isCircle) {

        if(Path[current].distance(script.myPosition()) > 50 || current > Path.length || !script.canReach(Path[current])) {
            current = 0;
        }

        if(current == Path.length-1 && isCircle) {
            script.log("Reseting path");
            current = 0;
            return true;
        }

        if(current+1 < Path.length && Path[current+1].distance(script.myPosition()) < 15) {
            current += 1;
            return true;
        }

        for(int i = current; i < Path.length; i++) {
            if(script.canReach(Path[i]) && i > current && Path[i].distance(script.client.getMyPlayer().getPosition()) < 16) {
                if(i+1 < Path.length && script.canReach(Path[i+1]) && Path[i+1].distance(script.myPosition()) < 16)
                    current = i+1;
                else
                    current = i;
                script.log("Current: "+current);
                script.log("Distance to current: "+Path[i].distance(script.myPosition()));

            }

        }

        return true;
    }

    public void WalkPath(Position[] path, boolean isCircle) throws InterruptedException {
        if(!script.isRunning() && script.client.getRunEnergy() > 50) {
            script.setRunning(true);
        }
        if(getNext(path, isCircle)) {
            script.walkMiniMap(path[current]);
        }

    }

}


Setting up this script is simple:

Walk walker = new Walk(this);

int[][] OuterAbyssPath = {
            {3017, 4823},
            {3017, 4825},
            {3017, 4827},
            removed
};

onLoop() {
            walker.WalkPath(walker.CreatePath(OuterAbyssPath),true);
            return 100;
}

Edited by QBots

Nice to see people contribute to community of Osbot ^^

 

 

Thanks

thanks, im try it out.

 

edit-

in this path, can you walk reverse?

Edited by josedpay

  • Author

thanks, im try it out.

 

edit-

in this path, can you walk reverse?

 

Ehrm, no but a reverse function is easy to write.

Looks good, I'm going to try it out, but what is the line that says

 

"removed"

 

after you give the coordinates for?

  • Author

Looks good, I'm going to try it out, but what is the line that says

 

"removed"

 

after you give the coordinates for?

 

The rest of the tiles.

This is great. I was about to write my own walking methods then I was like hmm, lets see if anyone is nice enough to share theirs. :D Thanks man, its working great, im implementing it in a script now!

  • 4 weeks later...

I'm getting an error, because I'm trying to implement your walking class, but when I add

Walk walk = new Walk(this);

I get an error for the word "this"

Edited by josedpay

  • 4 weeks later...

anyone else tested it? It comes to the end point and then goes there and back, in infinite loop...

anyone else tested it? It comes to the end point and then goes there and back, in infinite loop...

I suggest not using this, there's other methods which are more efficient, plus the 2d array isn't really necessary, just adds potential confusion/problems.

 

anyone else tested it? It comes to the end point and then goes there and back, in infinite loop...

I suggest not using this, there's other methods which are more efficient, plus the 2d array isn't really necessary, just adds potential confusion/problems.

 

could you link me another in PM? I can't find anything else :(

Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.