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.

Bot crashes when not in the area of npc

Featured Replies

I have a simple fishing bot, if you don't have the items needed it goes to get the items from your bank then goes to fish. The only problem is I use 

npcs.closest("Rod fishing spot").interact("lure");

to find the fishing spot. When I'm at the bank it just crashes after getting the items/being started(if it has the items.) If I start the bot in view of the fishing spots with the items it works perfectly. Help is much appreciated

After you are finished at the bank you should have a check if your in the fishing area (create an area variable) if not walk there else find the closest fishing spot and interact 

  • Author

Well, I was hoping to have it find the closest place that has a fishing spot, not have one preset.

RS only loads an area around you of a radius about 50 tiles or so. You can't just load all of the NPCs across the entire game and hope it finds the closest fishing spot to you.

  • Author

Is there any solution? or do I just have it go to specific areas?

57 minutes ago, bigd123 said:

Is there any solution? or do I just have it go to specific areas?

nullcheck it first. You're getting a crash because you're trying to interact with something that doesn't exist.

Area FISHING_AREA = new Area(x, x, x, x);
if (FISHING_AREA.contains(myPlayer()) {
  NPC fishingSpot = npcs.closest("Rod fishing spot");
  if (fishingSpot != null)  {
    fishingSpot.interact("lure");
    ConditionalSleeepHere until interacting
  }
}
    

will only search for the fishing spot if you're in the area you need to be. Also checks if it found the spot before interacting.

Basically just make sure that you interact only when you're sure that you have something to interact with

If you're not in the area, there are no fishing spots, so your "npcs" array has 0 length. There should be a function to check array length, and if its 0, don't operate on it.

 

your code should be something like this:

	if npcs.length > 0 {
	npcs.closest.interact
	} else {
	go to fishing spot
	}
	

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.