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.

Walking issue :(

Featured Replies

It's starting to really annoy me, I have to walk through an area where there's aggressive monsters and the walker sometimes just stands still, meaning I get to half health...

I don't see where the problem is, sometimes it works perfectly fine but sometimes it stands still for no reason.

 

public void walkPath(Position[] path, int startIndex, boolean reverse)
throws InterruptedException {
if (script.myPlayer().getPosition()
.distance(path[reverse ? 0 : path.length - 1]) <= 3
|| script.myPlayer().getPosition().distance(path[startIndex]) > 100)
return;
if (!reverse) {
for (int i = startIndex; i < path.length; i++) {
if (!walkTile(path[i], 3))
i--;
}
} else {
for (int i = startIndex; i >= 0; i--) {
if (!walkTile(path[i], 3))
i++;
}
}
}
 
public int getPathStartIndex(Position[] path, boolean reverse) {
int closestIndex;
int closest;
if (!reverse) {
closest = script.myPlayer().getPosition().distance(path[0]);
closestIndex = 0;
for (int i = 1; i < path.length; i++) {
if (script.myPlayer().getPosition().distance(path[i]) <= closest) {
closest = script.myPlayer().getPosition().distance(path[i]);
closestIndex = i;
}
}
} else {
closest = script.myPlayer().getPosition()
.distance(path[path.length - 1]);
closestIndex = path.length - 1;
for (int i = path.length - 1; i >= 0; i--) {
if (script.myPlayer().getPosition().distance(path[i]) <= closest) {
closest = script.myPlayer().getPosition().distance(path[i]);
closestIndex = i;
}
}
}
return closestIndex;
}
 
public boolean walkTile(Position p, int margin) throws InterruptedException {
if (script.myPlayer().getPosition().distance(p) <= margin)
return true;
else if (script.myPlayer().getPosition().distance(p) > margin)
script.client.moveMouseTo(
new MinimapTileDestination(script.bot, p), false, true,
false);
 
int failsafe = 0;
while (failsafe < 10
&& script.myPlayer().getPosition().distance(p) > margin) {
if ((script.client.getRunEnergy() > MethodProvider.random(25, 40) || script.myPlayer().isUnderAttack())
&& !script.isRunning()) {
script.client.getInterface(548).getChild(93).interact();
script.sleep(MethodProvider.random(500, 700));
}
script.sleep(100);
failsafe++;
if (script.myPlayer().isMoving())
failsafe = 0;
}
 
return script.myPlayer().getPosition().distance(p) <= margin;
}

Edit: Can't see anything wrong with the walker off the bat, try printing out your states and see if you're in the walking state still ?

Edited by Divinity

  • Author

Edit: Can't see anything wrong with the walker off the bat, try printing out your states and see if you're in the walking state still ?

Yeah, it happens in the middle of the path, I always print out the state when I'm testing my script :P. I've had this issue before but I sorted it out.

Only suggestion is here : 7BeiI.png

 

add:

!script.client.getRunEnergy() > MethodProvider.random(25,40) && !script.isRunning() || 

That's probably the only thing i can see wrong, cos if its under attack and above the run energy it will just keep clicking run on/off

Edited by Divinity

  • Author

Only suggestion is here : 7BeiI.png

 

add:

!script.client.getRunEnergy() > MethodProvider.random(25,40) && !script.isRunning() || 

That's probably the only thing i can see wrong, cos if its under attack and above the run energy it will just keep clicking run on/off

I did that because I want the character to run when it's being attacked so the monster can't keep up. It's not in the code I'm running right now and it's still doing the standing still..

With your current code it will click running on/off even if it is running due to your first statement so just add the !script.isRunning() before you handle the under attack part 

  • Author

With your current code it will click running on/off even if it is running due to your first statement so just add the !script.isRunning() before you handle the under attack part 

It's there...

GWcUdg1.png

Edited by FearMe

It's there...

GWcUdg1.png

 

No dude i mean like this: 

if ((script.client.getRunEnergy() > MethodProvider.random(25, 40) && !script.isRunning() || script.myPlayer().isUnderAttack())
&& !script.isRunning()) {

For every || you have you have to declare any existing logic, it doesn't carry over by itself

  • Author

No dude i mean like this: 

if ((script.client.getRunEnergy() > MethodProvider.random(25, 40) && !script.isRunning() || script.myPlayer().isUnderAttack())
&& !script.isRunning()) {

For every || you have you have to declare any existing logic, it doesn't carry over by itself

That's checking it twice..  It works fine like this, there's nothing wrong with that lol.

That's checking it twice..  It works fine like this, there's nothing wrong with that lol.

 

Edit: Oooooooooooooooooooh shit didn't see those brackets there.... facepalm

Edited by Divinity

Try putting your positions closer together, sometimes if you're near the edge of the current minimap load, it won't move to the next. If that makes sense. lel

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.