Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Trouble with examining random object.

Featured Replies

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?

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 by Imateamcape

You already have a thread.

 

Other one was in wrong section, locked that one.

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

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?

  • Author

@Imateamcape I needed it as one of my anti-ban features. Thanks for the help though.

@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 by Ayylmao420

  • 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?

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.