Jump to content

Best way to get/interact with Tiles


roguehippo

Recommended Posts

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

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