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.

Reachable Item checking

Featured Replies

So I ran a few scripts that'd get stuck trying to grab arrows from across the fence on the other side which would stop the bot from ignoring the fact that they can't actually reach it cause of clipped fence.

Here's a neat snippet for reachable ground item checking.

			GroundItem groundItems = getGroundItems().closest("Bronze arrows", "Feather");
			
			if (getMap().canReach(groundItems) && groundItems != null) {
				groundItems.interact("Take");
			}

The white circle is where arrows would appear from drops from the npcs shown right beside the circle or however they would apparently appear there.

SXt7e96.png

 

Should be pretty self explanatory, or even known. But I haven't personally seen this released or used in the few scripts I ran so eh.
For those wonder why I'm collecting arrows, it's to chance collect other players arrow drops, etc.. (just testing purposes right now).

Edited by Booleans YAY

So your snippet is just the API method:

getMap().canReach()

?...

:kappa:

I think most people are already aware of the existence of that method

Also you probably want to put the null check before the call to canReach()

Edited by Explv

How is that neat if you null check AFTER using the object? :???:
 

GroundItem groundItems = getGroundItems().closest("Bronze arrows", "Feather");
			
			if (groundItems != null && getMap().canReach(groundItems)) {
				groundItems.interact("Take");
			}

If you don't want a shitload of NPE's thrown in your face you should null check BEFORE actually using it ;)

Edited by Khaleesi

hey why does this throw a null pointer exception? :/ 

Good job on the contribution, it's nice that somebody is trying to help out;

 

As said above, if you null check after performing an action regarding the item, then it's pretty much redundant, so you should always validate the item first. Though, I don't know why so many are bashing when you're just trying to help.

At first I thought you were saying there was an error with map.canReach. 
Then I saw it was a snippet :facep:

I don't think it's necessary to post snippets of basic API codes. 
Might as well post snippets on how to open the bank using 

 

bank.open();

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.