Spacious Posted June 29, 2014 Posted June 29, 2014 Well, I have the rest of my ess miner working fine, but I've run into a problem. Apparently there are two types of portals used to exit the mine. (I'm not talking about how it switches from "Use Portal" to "Exit Portal") The first type of portal is detected fine, but I can't seem to get the second one. The real ID and the object ID both do not work, nor does trying to use it via a string method. When using the Entity Hover Debug its string name comes up as "<col=00ffff>Portal</col>" (which I found odd because it doesn't do that for any other objects that I've seen), with the ID next to it, and the realID has generally been around 2660 (with the object IDs being somewhere a little above that) Not sure how to go about getting this object. any help would be appreciated.
Spacious Posted June 29, 2014 Author Posted June 29, 2014 Search for entities for actions How would I go about that? lol (thank you btw)
Botre Posted June 29, 2014 Posted June 29, 2014 How would I go about that? lol (thank you btw) You will have to write a custom method for it. Add all RS2 objects and NPCs to a list and then go through that list by checking for all entities that have either Exit or Use in their actions then return the closest of that subset. I would give you the method but I'm releasing an ess miner myself, no hard feelings :p
Spacious Posted June 29, 2014 Author Posted June 29, 2014 Thank you everyone, I got it figured out! You will have to write a custom method for it. Add all RS2 objects and NPCs to a list and then go through that list by checking for all entities that have either Exit or Use in their actions then return the closest of that subset. I would give you the method but I'm releasing an ess miner myself, no hard feelings Haha I appreciate the help, thank you, I'm not planning on releasing mine though. It's much more just for a learning experience, I haven't scripted in a few years since rsbot so I'm just trying to refresh myself.
Extreme Scripts Posted June 29, 2014 Posted June 29, 2014 How would I go about that? lol (thank you btw) public RS2Object filterPortal(String action){ for(RS2Object o: objects.getAll()){ if(o != null && o.getDefinition().getActions()[0].equals(action)){ return o; } } return null; } The getActions()[0] will return the action in the first index of the list aka the First interaction option.
Khaleesi Posted June 29, 2014 Posted June 29, 2014 A portal can be a NPC or a RS2object. Also the name can be null.