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.

My NPC Filter sometimes tries swapping to new NPC

Featured Replies

Filter<NPC> gorillaFilter;

  if(myPlayer().isUnderAttack()){
  gorillaFilter = n -> n.getName().contains("Demonic") && n.getInteracting() == myPlayer();
  }else{
  gorillaFilter = n -> n.getName().contains("Demonic") && !n.isUnderAttack();
  }
  NPC a = npcs.closest(gorillaFilter);

 

I am having some trouble determining which gorilla to attack.  (Demonic gorilla) After I do boulder dodge, it will sometimes pick some random gorilla very far away and occasionally will just start trying to attack some other gorilla.  How can I enhance my `gorillaFilter` ?

private NPC getInteractingNPC() {
        return getNpcs().closest((Filter<NPC>) npc -> npc != null && npc.hasAction("Attack") && (myPlayer().isInteracting(npc) || (npc.isInteracting(myPlayer()) && !npc.isUnderAttack())));
}

What this does: 
Looks for npc that
has attack option AND (we are interacting with it OR  it is interacting with us AND not under attack)


Then for our main check we do
 

public NPC getAvailableNPC() {
        NPC npc = getInteractingNPC();
        return npc != null ? npc : PRIMARY_FILTER_HERE);
}

 It will make a call to getInteractingNPC()

if its null it will try to do your primary filter


PRIMARY_FILTER_HERE can be substituted with what you have on the main thread.

getNpcs().closest(n -> n.getName().contains("Demonic") && !n.isUnderAttack());

though I recommend adding more checks 

 

Then when you want to call 
 

NPC a = getAvailableNPC();

If (a != null && a.interact("Attack")) {
    // sleep until in combat ....... or w.e
}

 

@Brian

Edited by Chris

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.