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.

objects.get(int, int) and groundItems.get(int, int) not working?

Featured Replies

        int x = trapPosition.getX();
        int y = trapPosition.getY();
 
        List<RS2Object> objectsAtPos = script.objects.get(x, y);
        List<GroundItem> itemsAtPos = script.groundItems.get(x, y);
 
the last two lines give me errors: get(int, int) is not a method of Objects/groundItems.
 
        int x = trapPosition.getX();
        int y = trapPosition.getY();
 
        List<RS2Object> objectsAtPos = script.objects.getAll();
        List<GroundItem> itemsAtPos = script.groundItems.getAll();
 
does not give errors but i would like to use the first section of code.

 

Looks like get(x,y) is gone ohmy.png
(or it's new, still using the 2.3.58 api)

But you can always use a filter:

objects.filter(obj -> obj.getPosition().equals(trapPosition));

Edited by Flamezzz

  • Author

I have never used filters. Can you please explain how to make and use them? It would be greatly appreciated.

Also, edit:

what you're saying is

        List<RS2Object> objectsAtPos = script.objects.filter(obj -> obj
                .getPosition().equals(trapPosition));
will return a List of RS2Objects matching trapPosition?

Edited by elliottdehn

Well you pass a Filter of a specific type to objects.filter, groundItems.filter, npcs.filter etc. A Filter has the method match, in which you specify when an object/npc/grounditem meets certain requirements. Using Java 8 lambda expressions (probably needs to be enabled in your IDE) you can specify this as:

objects.filter(variable -> requirements)

Which is the same as ( Java < 8 ):

objects.filter(
 new Filter<RS2Object>() {
   public boolean match(RS2Object variable) {
    if (requirements)
       return true;
   else return false;

  }
});

Each time you return true for a specific object/npc/grounditem it passes the filter and is added to the list, which will be returned

Create an account or sign in to comment

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.