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.

walkMiniMap OSBOT 2?

Featured Replies

Is this deprecated? .____.

 

What's the new alternative?

 

 

 

 

 

 

 

 

 

-Please- tell me i don't have to bother with WalkingEvent's

Edited by Bitter

import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.input.mouse.MiniMapTileDestination;
import org.osbot.rs07.script.Script;

/**
 * Created with IntelliJ IDEA
 * User: Anthony
 * Date: 5/31/2014
 */

public class Walker {

	private final Script sI;

	public Walker(final Script sI) {
		this.sI = sI;
	}

	public boolean walkPath(final Position[] path) throws InterruptedException {
		return walkPath(path, 3);
	}

	public boolean walkPath(final Position[] path, int skipDist) throws InterruptedException {
		final Position nextTile = getNextTile(path, skipDist);
		if (nextTile != null) {
			if (sI.map.canReach(nextTile)) {
				clickMiniMapPosition(nextTile);
			}
			else {
				handleObstacleForPosition(nextTile);
			}
		}
		return path[path.length - 1].distance(sI.myPlayer()) < skipDist;
	}

	private Position getNextTile(final Position path[], int skipDist) {
		int dist = -1, closest = -1;
		for (int i = path.length - 1; i >= 0; i--) {
			Position tile = path[i];
			int d = sI.map.distance(tile);
			if (d < dist || dist == -1) {
				dist = d;
				closest = i;
			}
		}
		int feasibleTileIndex = -1;
		for (int i = closest; i < path.length; i++) {
			if (sI.map.distance(path[i]) <= skipDist) {
				feasibleTileIndex = i;
			}
			else {
				break;
			}
		}
		return (feasibleTileIndex == -1) ? null : path[feasibleTileIndex];
	}

	public Position[] reversePath(final Position[] path) {
		Position[] reversedPath = new Position[path.length];
		for (int i = 0; i < reversedPath.length; i++) {
			reversedPath[i] = path[path.length - i - 1];
		}
		return reversedPath;
	}

	private boolean clickMiniMapPosition(final Position position) throws InterruptedException {
		return sI.mouse.click(new MiniMapTileDestination(sI.bot, position));
	}

	private boolean handleObstacleForPosition(final Position position) {
		return sI.doorHandler.handleNextObstacle(position);
	}

}

I ported over a walking snippet I had laying around. Haven't tested it yet so it may need some tweaking.

Edited by Swizzbeat

import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.input.mouse.MiniMapTileDestination;
import org.osbot.rs07.script.Script;

/**
 * Created with IntelliJ IDEA
 * User: Anthony
 * Date: 5/31/2014
 */

public class Walker {

	private final Script sI;

	public Walker(final Script sI) {
		this.sI = sI;
	}

	public boolean walkPath(final Position[] path) throws InterruptedException {
		return walkPath(path, 3);
	}

	public boolean walkPath(final Position[] path, int skipDist) throws InterruptedException {
		final Position nextTile = getNextTile(path, skipDist);
		if (nextTile != null) {
			if (sI.map.canReach(nextTile)) {
				clickMiniMapPosition(nextTile);
			}
			else {
				handleObstacleForPosition(nextTile);
			}
		}
		return path[path.length - 1].distance(sI.myPlayer()) < skipDist;
	}

	private Position getNextTile(final Position path[], int skipDist) {
		int dist = -1, closest = -1;
		for (int i = path.length - 1; i >= 0; i--) {
			Position tile = path[i];
			int d = sI.map.distance(tile);
			if (d < dist || dist == -1) {
				dist = d;
				closest = i;
			}
		}
		int feasibleTileIndex = -1;
		for (int i = closest; i < path.length; i++) {
			if (sI.map.distance(path[i]) <= skipDist) {
				feasibleTileIndex = i;
			}
			else {
				break;
			}
		}
		return (feasibleTileIndex == -1) ? null : path[feasibleTileIndex];
	}

	public Position[] reversePath(final Position[] path) {
		Position[] reversedPath = new Position[path.length];
		for (int i = 0; i < reversedPath.length; i++) {
			reversedPath[i] = path[path.length - i - 1];
		}
		return reversedPath;
	}

	private boolean clickMiniMapPosition(final Position position) throws InterruptedException {
		return sI.mouse.click(new MiniMapTileDestination(sI.bot, position));
	}

	private boolean handleObstacleForPosition(final Position position) {
		return sI.doorHandler.handleNextObstacle(position);
	}

}

 

 

Thanks swizz.

I'll try to pick this apart until i understand most of the mapping api.

2014-06-01_18-44-30.png

1 tile is 4x4 pixels

 

The green rect is where we usually click on map, except red run button cuz it will turn on run instead walk.
Your player is always on center of this minimap, so my green thing is 150x154 (~38x~39 in tiles).
So your max clickable distance on this map from player is 38/2 = 19 in tiles width and 19,5 in tiles height.

So if you want to click on minimap your distance to dest cant be more than ~19 (safest one is 14 cuz it excludes run button).

The other way is to make ellipse around minimap:
2014-06-01_19-17-09.png

So the code will looks like:

 

2014-06-01_19-21-09.png

And then you loop positions while they are on map or otherwise if you are looping starting from fahrest ones.

2014-06-01_18-44-30.png

1 tile is 4x4 pixels

 

The green rect is where we usually click on map, except red run button cuz it will turn on run instead walk.

Your player is always on center of this minimap, so my green thing is 150x154 (~38x~39 in tiles).

So your max clickable distance on this map from player is 38/2 = 19 in tiles width and 19,5 in tiles height.

So if you want to click on minimap your distance to dest cant be more than ~19 (safest one is 14 cuz it excludes run button).

The other way is to make ellipse around minimap:

2014-06-01_19-17-09.png

So the code will looks like:

 

2014-06-01_19-21-09.png

And then you loop positions while they are on map or otherwise if you are looping starting from fahrest ones.

 

Why no polygon instead?

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.