kocke Posted April 12, 2015 Posted April 12, 2015 Hello Is there a way to get and check the id of an object? I need to check if the id of the object in question has change in the script.
kocke Posted April 12, 2015 Author Posted April 12, 2015 Isnt there a built one on the client I don't know, I looked for it for like 10 mins, but I can't find it...
Apaec Posted April 12, 2015 Posted April 12, 2015 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 2
kocke Posted April 12, 2015 Author Posted April 12, 2015 (edited) 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 Thank you, that was exactly what I was looking for. Edited April 12, 2015 by kocke 1
Abuse Posted November 27, 2016 Posted November 27, 2016 (edited) 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 November 27, 2016 by Abuse