Jump to content

Excluding an Object from interaction.


Zummy

Recommended Posts

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

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/

Link to comment
Share on other sites

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.

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