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

bug with getGroundItems cannot return item on table with realdistance true.

Featured Replies

ctx.getGroundItems().closest(true, Util.getAllPickupNames(ctx));

returns null (cannot find ground item) if "real distance" is true and the ground item is on top of a table, such as in the barbarian hall with the beer and cooked meat.

not sure the best way to work around this -- presumably the script is checking the walking distance to the location of the item, and since a table is a space you cannot walk to, it ignores the item when realdistance is true?

I worked around the issue thus:

        GroundItem pickUp = null;
        if (Location.BARBARIANHALL.getArea().contains(ctx.myPlayer())) {
            ctx.log("Attempting to pick up the Barbarian Hall drop table.");
            pickUp = ctx.getGroundItems().closest(true, Util.getAllPickupNames(ctx));
            if (pickUp == null) {
                ctx.log("Pickup null. Using alternate method.");
                pickUp = ctx.getGroundItems().closest(false, Util.getAllPickupNames(ctx));
                if (pickUp == null) {
                    ctx.log("Pickup still null.");
                    Util.enumerateGroundItems(ctx);
                }
            }

 

[INFO][Bot #1][01/14 12:10:32 AM]: This stack task status: Collecting meat and bones
[INFO][Bot #1][01/14 12:10:32 AM]: Attempting to pick up the Barbarian Hall drop table.
[INFO][Bot #1][01/14 12:10:32 AM]: Pickup null. Using alternate method.
[INFO][Bot #1][01/14 12:10:35 AM]: Have free slots, collect more meat and bones.

So I can confirm, items on top of a table will return null when using realdistance true.

  • 2 months later...
  • Developer

Interesting case, I'll see if there is a way where I can make this work.

A less optimal temporary method would be something along the lines of

GroundItem item = getGroundItems().getAll()
.stream()
.filter(x -> Util.getPickupNames(ctx).contains(x.getName()))
.filter(x -> x.getPosition().getArea(1).getPositions().stream().anyMatch(position -> getMap().canReach(position)))
.findFirst().orElse(null);

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.