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.

How to get entity (ignoring which is closest)

Featured Replies

I'm missing something silly and can't figure it out.

Right now I'm using

NPC fishingSpot = npcs.closest(o -> o.getName().contains("Fishing spot"));

and its super obvious when all the bots switch to the closest fishing spot at the same time. So I'm trying to switch my script to ignore which fishing spot is closest and just pick any of the ones it can find.

I checked the API documentation and I thought I could use npcs.getAll() but when I try

NPC fishingSpot = getNpcs().getAll().filter(new NameFilter("Fishing spot"));
and
NPC fishingSpot = npcs.getAll().filter(new NameFilter("Fishing spot"));

the editor is giving me an error on the ".filter" portion. I'm definitely using getAll() wrong but I'm not sure how to fix it.

@sinclair666
Only thing I can think of at the moment since I am tired but should work. First you can grab the closest fishing spot like I did below then grab the position and tell it the fishing spot you want is != to the second closest fishing spot's position.

NPC closestfishingSpot = getNpcs().closest(npc -> npc != null && npc.getName().equals("Fishing spot"));
        
NPC fishingSpot = getNpcs().closest(npc -> npc != null && npc.getName().equals("Fishing spot") && npc.getPosition() != closestfishingSpot.getPosition());

EDIT 1 Hold up I just had an idea and need a sec to test if it would work.
EDIT 2 : Nope nvm brian.exe stopped working and couldn't finish the thought sorry.

Edited by Gunman

 

List<NPC> fishingSpots = getNpcs().filter(new NameFilter<>("Fishing spot"));

 

 

Edited by FuryShark

  • Author
1 hour ago, Gunman said:

@sinclair666
Only thing I can think of at the moment since I am tired but should work. First you can grab the closest fishing spot like I did below then grab the position and tell it the fishing spot you want is != to the second closest fishing spot's position.


NPC closestfishingSpot = getNpcs().closest(npc -> npc != null && npc.getName().equals("Fishing spot"));
        
NPC fishingSpot = getNpcs().closest(npc -> npc != null && npc.getName().equals("Fishing spot") && npc.getPosition() != closestfishingSpot.getPosition());

EDIT 1 Hold up I just had an idea and need a sec to test if it would work.
EDIT 2 : Nope nvm brian.exe stopped working and couldn't finish the thought sorry.

Thanks

1 hour ago, FuryShark said:

 


List<NPC> fishingSpots = getNpcs().filter(new NameFilter<>("Fishing spot"));

 

 

Couldn't seem to get this working, the IDE is highlighting <NPC> and giving the error "Type java.awt.list does not have type parameters"

18 minutes ago, sinclair666 said:

Couldn't seem to get this working, the IDE is highlighting <NPC> and giving the error "Type java.awt.list does not have type parameters"

import java.util.List instead of java.awt.List;

  • Author
10 minutes ago, FuryShark said:

import java.util.List instead of java.awt.List;

Thanks! its working now

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.