FearMe Posted March 19, 2014 Share Posted March 19, 2014 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; } Link to comment Share on other sites More sharing options...
Extreme Scripts Posted March 19, 2014 Share Posted March 19, 2014 (edited) 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 March 19, 2014 by Divinity 1 Link to comment Share on other sites More sharing options...
FearMe Posted March 19, 2014 Author Share Posted March 19, 2014 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. Link to comment Share on other sites More sharing options...
Extreme Scripts Posted March 19, 2014 Share Posted March 19, 2014 (edited) Only suggestion is here : 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 March 19, 2014 by Divinity Link to comment Share on other sites More sharing options...
FearMe Posted March 19, 2014 Author Share Posted March 19, 2014 Only suggestion is here : 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.. Link to comment Share on other sites More sharing options...
Extreme Scripts Posted March 19, 2014 Share Posted March 19, 2014 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 Link to comment Share on other sites More sharing options...
FearMe Posted March 19, 2014 Author Share Posted March 19, 2014 (edited) 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... Edited March 19, 2014 by FearMe Link to comment Share on other sites More sharing options...
Extreme Scripts Posted March 19, 2014 Share Posted March 19, 2014 It's there... 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 Link to comment Share on other sites More sharing options...
FearMe Posted March 19, 2014 Author Share Posted March 19, 2014 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. Link to comment Share on other sites More sharing options...
Extreme Scripts Posted March 19, 2014 Share Posted March 19, 2014 (edited) 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 March 19, 2014 by Divinity Link to comment Share on other sites More sharing options...
Nezz Posted March 24, 2014 Share Posted March 24, 2014 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 Link to comment Share on other sites More sharing options...