Jump to content

Distance to x and y position


mr bot420

Recommended Posts

I'm asking to see if it's possible to see how close you are to a specific tile. something like this:

 

if (distanceTo(tile) <6) {

bank();

}else{

webwalk(varrockeast);

}

I know syntax is not correct in example just looking to see if it is possible. I know you can check areas and such but i want to see if you can do it this way. In API I can only see distanceto entity. I'm probably being a bad. Can someone help? if you find it in api can you tell me where you found it too. thanks :)

 

EDIT:

Would shift clicking be hard to implement too? wouldn't know where to start with this.

Edited by mr bot420
Link to comment
Share on other sites

use the.distance(entity) method when trying to calculate the distance

e.g

	if(Banks.GRAND_EXCHANGE.getRandomPosition().distance(myPosition()) < 6) {
	//code
	}
	 
	//another example
	private final Position alohaSnackbar = new Position(x,y,z);
	if(alohaSnackbar.distance(myPosition()) <= 6) //less than or equal to 6 {
	//code
	}
	

  • Like 1
Link to comment
Share on other sites

21 minutes ago, mr bot420 said:

I'm asking to see if it's possible to see how close you are to a specific tile. something like this:

 

if (distanceTo(tile) <6) {

bank();

}else{

webwalk(varrockeast);

}

I know syntax is not correct in example just looking to see if it is possible. I know you can check areas and such but i want to see if you can do it this way. In API I can only see distanceto entity. I'm probably being a bad. Can someone help? if you find it in api can you tell me where you found it too. thanks :)

 

EDIT:

Would shift clicking be hard to implement too? wouldn't know where to start with this.

P.S your player is a entity so .distance(entity) will apply to myPlayer().getPosition() or simply myPosition() both r the same thing i guess

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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