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

You could pre-define these doors (at least the ones you care about):

public enum Door {
	
	// DEFINE DOORS HERE
	
	VARROCK_DOOR_A("Big door", 1000, 2000, 0),
	VARROCK_DOOR_B("Doory door", 2000, 3000, 1),
	FALADOR_DOOR_A("White door", 3000, 4000, 2),
	
	// etc.
	;
	
	// OOP CODE HERE
	
	private final String name;
	private final int x;
	private final int y;
	private final int z; // -1 = ignore plane check
	
	private Door(String name, int x, int y, int z) {
		this.name = name;
		this.x = x;
		this.y = y;
		this.z. = z;
	}
	
	private Door(String name, int x, int y, int z) {
		this(name, x, y, -1);
	}
	
	@Override
	public String toString() {
		return String.format("[name=%s, x=%s, y=%s, z=%s]", name, x, y, z);
	}
	
	public boolean isDefined(RS2Object gameObject) {
		return gameObject.getName().equals(name)
			&& gameObject.getX() == x
			&& gameObject.getY() == y
			&& (z == -1 || gameObject.getZ() == z);
	}
	
	// static methdo (it belongs to Door class, not instantiated Door objects)
	public static boolean isDefined(RS2Object gameObject) {
		boolean defined = false;
		for (Door door : values()) {
			if (door.isDefined(gameObject)) {
				defined = true;
				break;
			}
		}
		return defined;
	}
}

It's pretty verbose and isn't very future proof, but you can get very nitty-gritty with how exact it is the things you want to find are, then you can do:

List<RS2Object> openableDoors = s.objects.getAll().stream().filter(Door::isDefined).collect(Collectors.toList());

With this, you don't necessarily need to search for the doors because the information about those doors are already defined. You'd only need to actually find those doors in-game when you intend to interact with them.

 

(Also there might be problems because this is ad-hoc code I wrote in notepad)

Edited by liverare

  • Author
Quote

You'd only need to actually find those doors in-game when you intend to interact with them.

Thanks for the reply. But this was the actual problem where getAll() didn't find the predefined objects, though they were quire close.

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.