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.

Zappa's Path Walking

Featured Replies

Put this just after your class extends script declaration (replace names and coordinates with your own):

ArrayList<Position> toMine = new ArrayList();
 
        public static Position[] MinePos = { new Position(2845, 2961, 0),
                new Position(2831, 2969, 0), new Position(2827, 2981, 0),
                new Position(2823, 2998, 0) };

Put this in your onStart(); statement:

loadPath(this.toMine, MinePos);

Put this after your onStart(); statement:

private void doWalk(ArrayList<Position> posList)
                        throws InterruptedException {
                for (Iterator localIterator = posList.iterator(); localIterator
                                .hasNext(); this.client.getMyPlayer().isMoving()) {
                        Position pos = (Position) localIterator.next();
                        walkMiniMap(pos);
                        sleep(1300 + random(600));
                }
        }
 
        private void loadPath(ArrayList<Position> list, Position[] pos) {
                for (Position path : pos)
                        list.add(path);
        }

Put this wherever you want to execute the walk:

 

try {
    doWalk(this.toMine);
} catch (Exception localException) {
}

Edited by Zappa

I've been thinking of making a script and I might use this is thats all good w/you?

  • Author

I've been thinking of making a script and I might use this is thats all good w/you?

 

Yea man! That is why it is in the snippet section! :D

  • 3 weeks later...

This is a pretty bad path walking implementation... 

 

1. - only supports 1 way walking

2. - only works if you start from the first position in the path

3. - you end up storing the exact same path twice... pointless?

 

Something along the lines of;

/**
 *
 * Walks through an array of tiles to reach the destination
 *
 * @param reverse whether we're going through the tiles in reverse.
 * @param distance the distance threshold of the destination.
 * @param path the tiles that we wish to traverse through
 * @return whether the tiles has been traversed (1), whether the tiles are currently being traversed (0), whether there was an error traversing a tile (-1) or whether the tiles cannot be traversed (-2).
 * @throws InterruptedException
 */
public int walk(boolean reverse, int distance, Position... path) throws InterruptedException {

	if(distance(path[path.length-1]) <= distance && !reverse)
		return 1;
		
	if(distance(path[0]) <= distance && reverse)
		return 1;

	for(int i = reverse ? 0 : path.length-1; reverse ? i < path.length : i >= 0; i += reverse ? 1 : -1) {

		if(path[i] == null || distance(path[i]) <= distance)
			return -1;

		if((distance(path[i]) <= 18) || i == (reverse ? path.length-1 : 0)) {
			if(!canReach(path[i])) {
				if(doorHandler.handleNextObstacle(path[i]) == -1)
					return -2;
			} else
				walk(path[i]);
			return 0;
		}
	}
	return -2;
}

Would be much better.

  • Author

This is a pretty bad path walking implementation... 

 

1. - only supports 1 way walking

2. - only works if you start from the first position in the path

3. - you end up storing the exact same path twice... pointless?

 

Something along the lines of;

/**
 *
 * Walks through an array of tiles to reach the destination
 *
 * @param reverse whether we're going through the tiles in reverse.
 * @param distance the distance threshold of the destination.
 * @param path the tiles that we wish to traverse through
 * @return whether the tiles has been traversed (1), whether the tiles are currently being traversed (0), whether there was an error traversing a tile (-1) or whether the tiles cannot be traversed (-2).
 * @throws InterruptedException
 */
public int walk(boolean reverse, int distance, Position... path) throws InterruptedException {

	if(distance(path[path.length-1]) <= distance && !reverse)
		return 1;
		
	if(distance(path[0]) <= distance && reverse)
		return 1;

	for(int i = reverse ? 0 : path.length-1; reverse ? i < path.length : i >= 0; i += reverse ? 1 : -1) {

		if(path[i] == null || distance(path[i]) <= distance)
			return -1;

		if((distance(path[i]) <= 18) || i == (reverse ? path.length-1 : 0)) {
			if(!canReach(path[i])) {
				if(doorHandler.handleNextObstacle(path[i]) == -1)
					return -2;
			} else
				walk(path[i]);
			return 0;
		}
	}
	return -2;
}

Would be much better.

 

 

Yea, this post is old. I have learned a lot since then haha. I basically made that when I first started scripting.

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.