Jump to content

Excluding an Object from interaction.


Recommended Posts

Posted (edited)

I want to mine only a certain set of rocks but I can't seem to exclude others, this is my pseudo code:

RS2Object rock1 = getObjects().closest(7454);

if (rock1.getGridX() != 10176){
	// mine rock
}

Is there a proper way instead of looking at the object's grid coordinates?

Thanks

Edited by Zummy
Posted
2 hours ago, Zummy said:

I want to mine only a certain set of rocks but I can't seem to exclude others, this is my pseudo code:


RS2Object rock1 = getObjects().closest(7454);

if (rock1.getGridX() != 10176){
	// mine rock
}

Is there a proper way instead of looking at the object's grid coordinates?

Thanks


1. Use colours instead of IDs for rocks:
 


2. Use an Area to filter the rocks, not gridX and gridY:
 

private static final Area ROCK_AREA = new Area(1, 2, 3, 4);

RS2Object tinRock = getObjects().closest(obj -> ROCK_AREA.contains(obj) && Rock.TIN.hasOre(obj));


Areas can be calculated using the OSBot entity hover setting, or using my map https://explv.github.io/

Posted
1 hour ago, Explv said:


1. Use colours instead of IDs for rocks:

2. Use an Area to filter the rocks, not gridX and gridY:

Areas can be calculated using the OSBot entity hover setting, or using my map https://explv.github.io/

Thank you again! I really appreciate all the help, that map tool is absolutely great! I do get a warning tho on my getObjects().closest() code -> Unchecked generics array creation for varargs parameter.

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