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.

Flawless Path Walking

Featured Replies

	public boolean WalkAlongPath(int[][] path, boolean AscendThroughPath, int distanceFromEnd) {
		if (distanceToPoint(AscendThroughPath ? path[path.length - 1][0] : path[0][0],
				AscendThroughPath ? path[path.length - 1][1] : path[0][1]) <= distanceFromEnd)
			return true;
		else {
			WalkAlongPath(path, AscendThroughPath);
			return false;
		}
	}

	public void WalkAlongPath(int[][] path, boolean AscendThroughPath) {
		int destination = 0;
		for (int i = 0; i < path.length; i++)
			if (distanceToPoint(path[i][0], path[i][1]) < distanceToPoint(path[destination][0], path[destination][1]))
				destination = i;
		if (script.client.getMyPlayer().isMoving() && distanceToPoint(path[destination][0], path[destination][1]) > (script.isRunning() ? 3 : 2))
			return;
		if (AscendThroughPath && destination != path.length - 1 || !AscendThroughPath && destination != 0)
			destination += (AscendThroughPath ? 1 : -1);
		try {
			log("Walking to node:" + destination);
			script.walk(new Position(path[destination][0], path[destination][1], 0));
			Thread.sleep(700 + MethodProvider.random(600));
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

	private int distanceToPoint(int pointX, int pointY) {
		return (int) Math.sqrt(Math.pow(script.client.getMyPlayer().getX() - pointX, 2)
				+ Math.pow(script.client.getMyPlayer().getY() - pointY, 2));
	}

 

This allows you to have your character walk along a path, starting at any point along the path. It will walk like a human, not like a bot.

This is how you'd use it:

private int[][] path1 = new int[][] { { 3206, 3209 }, { 3215, 3211 }, { 3217, 3218 }, { 3225, 3218 },
			{ 3235, 3220 }, { 3242, 3226 }, { 3252, 3226 }, { 3251, 3235 }, };

public void walkToGoblins() {
    WalkAlongPath(path1, true);
}

public void walkToBankFromGoblins() {
    WalkAlongPath(path1, false);
}

public void walkToGoblinsThenAttack() { 
    if(WalkAlongPath(path1, true, 1)) //The 1 is the distance away from destination
       state = State.AttackGoblins;
}

Enjoy.

Edited by Divine

i read somewhere people that wanna become a scripter need to do something ''out of the box''

kati. we have a new scripter :D

Finally. Now osbot can have scripts with a little more complexity. Thanks.

Edited by LedZeppelin

  • Author

Why Do I get errors on the distanceToPoint?

My mistake, forgot to include it in the code!

for some reason its trying to run many nodes at once 

Edited by nxjr

Looks pretty decent! biggrin.png
Will test this in 1 of my scripts!

Thanks!!
 

grtz
H0ppy

Edited by H0ppy

5th edit: Is there a debug to draw the path onscreen?

Edited by 03storic

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.