Jump to content

Path Walking


PwneRL33T

Recommended Posts

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

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.

  • Like 1
Link to comment
Share on other sites

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

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.

  • Like 1
Link to comment
Share on other sites

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 by PwneRL33T
Link to comment
Share on other sites

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 by FrostBug
Link to comment
Share on other sites

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. QwPha8E.png

Edited by Pug
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...