January 10, 20179 yr boolean examined = false; List<RS2Object> allEntities = new ArrayList<RS2Object>(); allEntities = objects.getAll(); do { RS2Object obj = allEntities.get(random(0, allEntities.size() - 1)); if (obj != null && obj.hasAction("Examine")) { obj.interact("Examine"); examined = true; log(obj.getName() + " examined."); } } while (!examined); I am trying to get a list of all the entities around me and examine one at random. I seem to be able to get a random object just fine, but it never actually gets past this part. if (obj != null && obj.hasAction("Examine")) { Any ideas why?
January 10, 20179 yr Edit (my post from the last thread): ran into this awhile ago. I realized that if an object has a name, then it has the examine option, so you might want to try if(object.getName() != null) {}, because for whatever reason, it doesnt appear in the list of interact options (i checked this many times). if you want to interact and examine it, there is also a method for that - object.examine(). Hope this helped Edited January 11, 20179 yr by Imateamcape
January 11, 20179 yr Author Other one was in wrong section, locked that one. Didn't know which was the correct one, sorry about that. Edit (my post from the last thread): ran into this awhile ago. I realized that if an object has a name, then it has the examine option, so you might want to try if(object.getName() != null) {}, because for whatever reason, it doesnt appear in the list of interact options (i checked this many times). if you want to interact and examine it, there is also a method for that - object.examine(). Hope this helped if (obj.getName() != null) {} So this works now and I tried both obj.interact("Examine") and obj.examine() (which is deprecated btw) but neither work.
January 11, 20179 yr I'm fairly sure .interact("Examine") won't work because it's not one of the options. If .examine() isn't working, not sure what to tell you. Sorry bro. Glad the first part helped. Why might you need to .examine() method anyway? Is there any way to get around it?
January 11, 20179 yr Author @Imateamcape I needed it as one of my anti-ban features. Thanks for the help though.
January 11, 20179 yr @Imateamcape I needed it as one of my anti-ban features. Thanks for the help though. RS2Object object = getObjects().getAll().stream().filter(o -> o.getName() != null && o.getActions() != null).min((o1, o2) -> Integer.compare(getMap().distance(o1), getMap().distance(o2))).orElse(null); if (object != null) { if (getMenuAPI().isOpen()) { for (Option option : getMenuAPI().getMenu()) { if (option.action.equals("Examine")) { log(option.action); } } } } Finds examine option from the menu so if you want to do it this way, use custom interaction method. Edited January 11, 20179 yr by Ayylmao420
January 11, 20179 yr Author RS2Object object = getObjects().getAll().stream().filter(o -> o.getName() != null && o.getActions() != null).min((o1, o2) -> Integer.compare(getMap().distance(o1), getMap().distance(o2))).orElse(null); if (object != null) { if (getMenuAPI().isOpen()) { for (Option option : getMenuAPI().getMenu()) { if (option.action.equals("Examine")) { log(option.action); } } } } Finds examine option from the menu so if you want to do it this way, use custom interaction method. How do I click on the option once I find it?
January 11, 20179 yr How do I click on the option once I find it? http://osbot.org/forum/topic/101792-better-interaction/