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.

NullPointer when using MethodProvider in other classes

Featured Replies

I'm writing a sand crab bot and currently writing the logic for checking what spots are available.

I've been debugging a null pointer problem I've been getting and it looks like whenever I try and use a method from the MethodProvider class (currently trying log) I get a null pointer.

Create an instance of SpotManager passing the RIFTSandCrabs class (my script) ,,,

public class RIFTSandCrabs extends Script {
	
	...
	
	private SpotManager spotManager = new SpotManager(this);

And then in my SpotManager I have this ...

public class SpotManager extends MethodProvider {
	
	...

	private Script RIFTSandCrabs;
	
	public SpotManager(Script RIFTSandCrabs) {
		this.RIFTSandCrabs = RIFTSandCrabs;
	}
	
	...
	
	private void updatePositions() {
		for (int i = 0; i < crabLocations.length; i++ ) {
			log(i);
			updatePosition(crabLocations[i], i);
		}
	}
	
	private void updatePosition(Position p, int index) {
		RIFTSandCrabs.stop(false);
		log("Position coords are " + p.toString());
		log("Players located are " + getPlayers());
		log("Result of isEmpty() is " + getPlayers().get(p.getX(), p.getY()).isEmpty());
		
		if (getPlayers().get(p.getX(), p.getY()).isEmpty()) {
			spotStatus[index] = true;
		}
	}
	
	...
                                                 
}

I pass the instance of my script through to this class only to stop executing at a certain point to check logs etc.

What I'm trying to do is make sure the logic I have in place to check if a spot is free is correct and is returning what I want it to return. I get a null pointer at " log(i) " inside the for loop of updatePositions( ).

I'm a Java nooblet, so any help would be appreciated

EDIT:

Solved problem. Resource was in Explvs Tutorial (5).

Close please

Edited by R I F T
Solved

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.