PwneRL33T Posted September 3, 2014 Posted September 3, 2014 (edited) this is my loop http://pastebin.com/JcAAhMb7 and this is what happens i i just don't know what to do now I'm completely stuck.. "go learn basic java" they say, trust me iv'e learnt it and studied it over and over, but no basic java tuts show me about paths for a runescape bot :L pathwalking method public void walkPath(Position[] path) throws InterruptedException { for (Position p : path) { if ((myPosition().distance(p) <= 16) && (myPosition().distance(p) >= 3)) { boolean success; do { success = walkTile(p); } while (!success); } } } public boolean walkTile(Position p) throws InterruptedException { if (myPosition().distance(p) > 13) { Position pos = new Position( (p.getX() + myPosition().getX()) / 2 + MethodProvider.random(-3, 3), (p.getY() + myPosition().getY()) / 2 + MethodProvider.random(-3, 3), myPosition() .getZ()); walkTile(pos); } for (int i = 0; i < 2; i++) { mouse.click(new MiniMapTileDestination(bot, p), false); } mouse.click(new MiniMapTileDestination(bot, p), false); int fail = 0; while ((myPosition().distance(p) > 2) && (fail < 10)) { MethodProvider.sleep(500L); if (!myPlayer().isMoving()) { fail++; } } return fail != 10; } Edited September 3, 2014 by PwneRL33T
Botre Posted September 3, 2014 Posted September 3, 2014 (edited) You should try and provide some more details, which methods are successively called for example ? Edit: seems like walkPath(path2); is causing it, you should post the method / path in question ^^ Edited September 3, 2014 by Botrepreneur
PwneRL33T Posted September 3, 2014 Author Posted September 3, 2014 You should try and provide some more details, which methods are successively called for example ? Edit: seems like walkPath(path2); is causing it, you should post the method / path in question ^^ done
Botre Posted September 3, 2014 Posted September 3, 2014 done Those are just the position arrays, mind posting the method you feed them in to ? I'm talking about the walkPath(position array) method ^^
PwneRL33T Posted September 3, 2014 Author Posted September 3, 2014 Those are just the position arrays, mind posting the method you feed them in to ? I'm talking about the walkPath(position array) method ^^ oh right sorry, added now
Botre Posted September 3, 2014 Posted September 3, 2014 (edited) (p.getX() + myPosition().getX()) / 2 + MethodProvider.random(-3, 3) 1) Parentheses! ((p.getX() + myPosition().getX()) / 2) + MethodProvider.random(-3, 3) Same applies to what you do for the Y coordinate. 2) Redundant action repetition for (int i = 0; i < 2; i++) { mouse.click(new MiniMapTileDestination(bot, p), false); // YOU CLICK TWICE HERE } mouse.click(new MiniMapTileDestination(bot, p), false); // AND A THIRD TIME HERE 3) Awkward sleeping The idea of having a fail counter isn't bad at all, this while loop makes no sense whatsoever though. The fail int doesn't represent actual fails, just you not moving. After each fail you should probably retry the walkTile method instead of just sleeping again. while ((myPosition().distance(p) > 2) && (fail < 10)) { MethodProvider.sleep(500L); if (!myPlayer().isMoving()) { fail++; } } ^not very effective Edited September 3, 2014 by Botrepreneur
PwneRL33T Posted September 3, 2014 Author Posted September 3, 2014 Cute Username idk lol its a pure bot account :P
Joseph Posted September 3, 2014 Posted September 3, 2014 (edited) http://osbot.org/forum/topic/55480-walker-with-basic-obstacle-handling/ The reason why it walks to the second position then walks back to the first is because you have only one loop, you loop though the position, since your looping from the beginning to the end. Your near the first position it will walk to the second, and once your walking it's still looping through the positions from the beginning so while your conditions are correct it will go back to the first. Why it's a never ending loop. In swizz method he has two loop, regular loop, and a loop in reverse. He uses the reverse path to find the next furthest available position. Rather then looping and finding the closest tile from the beginning of the loop. If you don't understand me look at his method, get next tile and read it Edited September 3, 2014 by josedpay
PwneRL33T Posted September 4, 2014 Author Posted September 4, 2014 I like your profile pic, what type? hah cheers, just sold it the other day though and got a mercedes benz :P its a VY 5sp