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.

Getting all objects in a wide area

Featured Replies

I''m failing to find a way how to get a bunch of objects in a given slightly bigger area.

It isn't really that big :

x cord span: 38

y cord span: 45.

When using methods like

List<RS2Object> openableDoors = s.objects.getAll().stream().filter(f -> f.getName().equals("Door") && f.hasAction("Open")).collect(Collectors.toList());

or 

List<RS2Object> objList = s.objects.filter(f -> f.getName().equals(objectName) && f.hasAction(objectAction));
		if (!objList.isEmpty()) {
			RS2Object lever = objList.get(0);
            // Do stuff
        } else {
          s.log("Couldn't find object: " + objectName); 
        }

I was hoping that this gives me all the objects that are loaded in region. (The objects exists and actually are visible)

When I manually walk a lil closer to the object I want to interact, the script finds the object. 

I have a hunch that these methods have a "max search distance" or something.

Anyway to get a full list of objects loaded or in a given (a lil bigger) area? 

Edited by nosepicker

  • Author
2 minutes ago, Chris said:

area.contains(f.getposition) ?

This should "slim down" the possible results, not expand the search area

Edited by nosepicker

7 minutes ago, nosepicker said:

This should "slim down" the possible results, not expand the search area

You could just define a huge area? From what it looks like you are doing, it'll work with what you are trying to do. Looks like you are just trying to find a door

  • Author
31 minutes ago, WhoKnew said:

You could just define a huge area? From what it looks like you are doing, it'll work with what you are trying to do. Looks like you are just trying to find a door

What difference should it bring in just "finding an object that I can see". Atm I don't care if the object I want in the area I want, could be X other objects outside my desired area :) The problem I'm facing is that the script doesn't find the object even when I see it (from far away - maybe like 15-20 or so tiles).

After playing around noticed that if I rotate the camera a lil towards the object, the script finds the object.

Apart from adding failsafes like rotate camera or walk around, any bulletproof ways to do this?

The game only loads objects up to 15 tiles away from your player so you won't be able to get all the objects in an area that big.

  • Author
7 hours ago, El_Maestro said:

Trying running your current snippet from the same game position twice. Print how many objects you find. If something is wrong it should print a different number every run.

Running this every loop iteration. Will try to see the size of the returned list, thanks!

6 hours ago, d0zza said:

The game only loads objects up to 15 tiles away from your player so you won't be able to get all the objects in an area that big.

Thanks for the info. But isn't there something like a "loaded region"? Should be bigger than 15 tiles

Also when I see the object in the distance I can right click on it and interact with it, so it's loaded in game, but the script has trouble finding it

6 hours ago, d0zza said:

The game only loads objects up to 15 tiles away from your player so you won't be able to get all the objects in an area that big.

Are you sure that's true? at ZMI you can click on the alter when you're over 15 tiles away easily.

  • Author
21 minutes ago, El_Maestro said:

The game is loading, I think the api method may just have a preset distance cap because you don't usually need anything bigger. I've always noticed that it only gets npcs that are on your minimap.

This minimap thing might be the case. Will test to confirm. Though if it's true, any methods to load beyond minimap?

getObjects().getAll() returns all objects in your loaded region, you're obviously doing something wrong here.

  • Author
55 minutes ago, dreameo said:

Try to stand further away from your object until it's not visible in minimap and tell me how it goes :boge:

What I noticed though:

1) Object must be on minimap to be found (after login). If it was on minimap earlier, then it can be found later without problems.

2) Methods closest(Area, objectName), getAll() adhere to the 1st rule.

41 minutes ago, nosepicker said:

Try to stand further away from your object until it's not visible in minimap and tell me how it goes :boge:

What I noticed though:

1) Object must be on minimap to be found (after login). If it was on minimap earlier, then it can be found later without problems.

2) Methods closest(Area, objectName), getAll() adhere to the 1st rule.

I've had issues before with getObjects() in general. It picked up things that aren't actually there. Hence when I tested out the max tile distance, I got 73 (Logged in and testing where I stood - didn't move). 

If objects aren't being loaded because they are too far, not sure if there's anything that you could even do about it lol. 

Play around and do some tests :troll:

  • Author
11 minutes ago, dreameo said:

I've had issues before with getObjects() in general. It picked up things that aren't actually there. Hence when I tested out the max tile distance, I got 73 (Logged in and testing where I stood - didn't move). 

If objects aren't being loaded because they are too far, not sure if there's anything that you could even do about it lol. 

Play around and do some tests :troll:

73 Tiles? Quite a lot. I test by completely relaunching the client, so should be fresh cache.

Anyway, "solved" the issue by first traveling around the area for all objects to load properly. All works as expected after this.

2 minutes ago, nosepicker said:

73 Tiles? Quite a lot. I test by completely relaunching the client, so should be fresh cache.

Anyway, "solved" the issue by first traveling around the area for all objects to load properly. All works as expected after this.

Hmmm wouldn't it just save a cache of the objects? If they are dynamic objects, then it wouldn't be that much of a solution. 

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.