Jump to content

Best way to get/interact with Tiles


Recommended Posts

Posted (edited)

??? Maybe look at the API?

You can make a Position using:

Position position = new Position(x, y, z);

Walk to it using a WalkingEvent with minDistanceThreshold set to 0:

WalkingEvent walkingEvent = new WalkingEvent(position);
walkingEvent.setMinDistanceThreshold(0);
execute(walkingEvent);

Check if an object is on the position by using filter (or singleFilter, or whatever else):

List<RS2Object> objectsOnPos = getObjects().filter(new PositionFilter<>(position));

// or

boolean isHunterTrapOnPos = !getObjects().filter(new PositionFilter<>(position), new NameFilter<>("Hunter trap")).isEmpty();

Draw the position on screen using:

graphics2D.drawPolygon(position.getPolygon(getBot());

 

Edited by Explv
  • Like 2
Posted (edited)

Color tile:
 

Position tile;
g.fillPolygon(tile.getPolygon(bot));

 

Check if specif object on tile:
 

RS2Object obj;
Position tile;
if(obj.getPosition().equals(tile){
	//your code here
}

You can combine the above code with a filter to filter out objects based on name or what ever you want

Edited by HunterRS

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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