PwneRL33T Posted August 27, 2014 Share Posted August 27, 2014 hey guys, ive finally finished my main project and have started another one... but this one requires a fair distance from the bank... so i was wondering how do i go about making a path? as its to far to just have main area and then the bank area, ive got all the coords down for the path.. but dont know how to implement it to walk to bank when invo full and walk back to main area when not full.. Link to comment Share on other sites More sharing options...
Swizzbeat Posted August 27, 2014 Share Posted August 27, 2014 Iterate over every position in the path to find the closest one to your current position. Once you have that either begin incrementing through the array again from the closest position (if ascending through the path, decrement if descending) checking each position to see whether or not it is within a "walking distance" threshold you set (normally 12-15). If the position is within your threshold, simply store the index and continue checking along the array, storing indexes for positions within the threshold as you go along. Once you reach either the end of the array or a position outside of the threshold return the position at the last stored index. Remember that you should account for what happens if no positions were found within your threshold. 1 Link to comment Share on other sites More sharing options...
PwneRL33T Posted August 27, 2014 Author Share Posted August 27, 2014 Iterate over every position in the path to find the closest one to your current position. Once you have that either begin incrementing through the array again from the closest position (if ascending through the path, decrement if descending) checking each position to see whether or not it is within a "walking distance" threshold you set (normally 12-15). If the position is within your threshold, simply store the index and continue checking along the array, storing indexes for positions within the threshold as you go along. Once you reach either the end of the array or a position outside of the threshold return the position at the last stored index. Remember that you should account for what happens if no positions were found within your threshold. Sorry I don't understand what you mean, something I could more understand would be like, get all your positions making sure they are within clickable distance (usually 10-12 tiles) and the do blah blah, sorry I don't understand when you state, I already have all my positions but just how to make them actually work for the script I am unsure. private final Area BANK_PATH = new Area(new Position[] { new Position(3240, 3302, 0), new Position(3236, 3307, 0), new Position(3225, 3321, 0), new Position(3212, 3333, 0), new Position(3204, 3349, 0), new Position(3201, 3367, 0), new Position(3187, 3378, 0), new Position(3176, 3391, 0), new Position(3170, 3407, 0), new Position(3172, 3424, 0) }); private final Area PICK_PATH = new Area(new Position[] { new Position(3172, 3424, 0), new Position(3170, 3407, 0), new Position(3176, 3391, 0), new Position(3187, 3378, 0), new Position(3201, 3367, 0), new Position(3204, 3349, 0), new Position(3212, 3333, 0), new Position(3225, 3321, 0), new Position(3236, 3307, 0), new Position(3240, 3302, 0) }); Link to comment Share on other sites More sharing options...
Swizzbeat Posted August 27, 2014 Share Posted August 27, 2014 Sorry I don't understand what you mean, something I could more understand would be like, get all your positions making sure they are within clickable distance (usually 10-12 tiles) and the do blah blah, sorry I don't understand when you state, I already have all my positions but just how to make them actually work for the script I am unsure. private final Area BANK_PATH = new Area(new Position[] {new Position(3240, 3302, 0),new Position(3236, 3307, 0),new Position(3225, 3321, 0),new Position(3212, 3333, 0),new Position(3204, 3349, 0),new Position(3201, 3367, 0),new Position(3187, 3378, 0),new Position(3176, 3391, 0),new Position(3170, 3407, 0),new Position(3172, 3424, 0)}); private final Area PICK_PATH = new Area(new Position[] {new Position(3172, 3424, 0),new Position(3170, 3407, 0),new Position(3176, 3391, 0),new Position(3187, 3378, 0),new Position(3201, 3367, 0),new Position(3204, 3349, 0),new Position(3212, 3333, 0),new Position(3225, 3321, 0),new Position(3236, 3307, 0),new Position(3240, 3302, 0)}); Mate, you really need to learn Java. You've been making countless posts asking to be spoonfed while ignoring the fact that YOU CANNOT SCRIPT WITHOUT JAVA KNOWLEDGE.Also, that code is incorrect and doesn't make a path what so ever. I suggest you look into constructors and what they are. 1 Link to comment Share on other sites More sharing options...
PwneRL33T Posted August 27, 2014 Author Share Posted August 27, 2014 (edited) Mate, you really need to learn Java. You've been making countless posts asking to be spoonfed while ignoring the fact that YOU CANNOT SCRIPT WITHOUT JAVA KNOWLEDGE. Also, that code is incorrect and doesn't make a path what so ever. I suggest you look into constructors and what they are. I'm not asking to be spoonfed, I asked you to put it in a way that a beginner java scripter would understand, I didn't ask for the code for pathing, I simply asked you to put it an easier way, I'm not at your level of coding I can't understand what you are saying. Edited August 27, 2014 by PwneRL33T Link to comment Share on other sites More sharing options...
FrostBug Posted August 27, 2014 Share Posted August 27, 2014 (edited) The easiest (but potentially unsafe) way to do it would be to use an index variable (int). When you are at one end of your path, set the index variable to the index of the first position you wish to walk to (0 or path length - 1). If you are close enough to the tile, increment or decrement your index variable (depending on which way you're walking on the path) otherwise, walk to the position. Edited August 27, 2014 by FrostBug Link to comment Share on other sites More sharing options...
Pug Posted August 27, 2014 Share Posted August 27, 2014 (edited) declare a path: Position [] path1 = { new Position(x co-ord, y co-ord, z co-ord), new Position(x co-ord, y co-ord, z co-ord), new Position(x co-ord, y co-ord, z co-ord), }; Example walking method as posted by me some weeks ago: 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; } example use: walkPath(path1); if ((settings.getRunEnergy() > 20 +gRandom(1,10)) && (!settings.isRunning())) { run(); } run method if you want it: private void run() throws InterruptedException { if(configs.isSet(173, 0)) { Rectangle localRectangle = new Rectangle(570, 127, 20, 20); mouse.click(new RectangleDestination(bot, localRectangle), false); sleep(800); } } you are most welcome. Please try to search the forum before asking questions in the future all the content above has been posted to help new member such as yourself before numerous times. Edited August 27, 2014 by Pug Link to comment Share on other sites More sharing options...
Joseph Posted August 28, 2014 Share Posted August 28, 2014 If you look on the snippet section you'll see like three walking snippet. Also rather then check the config to see if you have orb active why don't you use the method setting#isDataOrbActive Link to comment Share on other sites More sharing options...
GoldenGates Posted August 28, 2014 Share Posted August 28, 2014 That's a large spoon to be fed from for a small child. Jokes aside, you should look at the provided method and read and understand it carefully. A path walker shouldn't be an issue whatsoever as you get better, meaning you have lots to learn, but the beginning is always fun. 3 Link to comment Share on other sites More sharing options...