Jump to content

Get and check id of an object?


kocke

Recommended Posts

I'm not sure you understand the question.

 

Are you asking how to check the ID of an object ? if so go into settings and open the 'Entity Debugger'. Then hover over the entity in question and it will tell you the id.

 

Or....

 

Did you mean how do you get the id of an entity dynamically in the code?

Entity e = objects.closest("name");
int id = e.getId();

Apaec

  • Like 2
Link to comment
Share on other sites

  • 1 year later...

There are multiple ways of finding objects

 

One is using an id:

RS2Object myObject = getObjects().closest(2565);

Another way would be using the object name:

RS2Object myObject = getObjects().closest("Bank booth");

and if you want to match on a specific variable of an object you could use filters:

Filter<RS2Object> modelIdFilter = new Filter<RS2Object>() {
   public boolean match(RS2Object n) {
      return (n.getModel() == 1234);
   }
};      

RS2Object myObject = self.getObjects().closest(modelIdFilter);

after that you can use myObject.getId() to get the ID value of that object

 

Edit: Just realized when this post was made :(

Edited by Abuse
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...