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.

Method to hover over next npc

Featured Replies

Does anyone have a method to hover over next npc for a combat script?

Or some advice on how to write my own method for this?

Thanks!

20 minutes ago, Prolax said:

Does anyone have a method to hover over next npc for a combat script?

Or some advice on how to write my own method for this?

Thanks!

U can filter closest NPC:
Example(Not sure as I typed it her not in IDE so check it out):

NPC npc = getNpcs().closest(f-> !f.isUnderAttack && f.gethitpoints > 0 && !f.isHitbarvisibile)

EDIT: check fruity's post

Edited by progamerz

Character<?> character = script.myPlayer().getInteracting();
if (character != null && character.getHealthPercentCache() < 30) {
    NPC next = script.getNpcs().closest(n -> n.getName().equals("NAME") && !n.isUnderAttack() && n != character && n.getHealthPercentCache() > 0);
    next.hover();
}

Make sure to add n.getName().equals("NAME")

Not tested but im sure it will be something similar

Edited by Fruity

  • Author
11 minutes ago, Fruity said:

Character<?> character = script.myPlayer().getInteracting();
if (character != null && character.getHealthPercentCache() < 30) {
    NPC next = script.getNpcs().closest(n -> n.getName().equals("NAME") && !n.isUnderAttack() && n != character && n.getHealthPercentCache() > 0);
    next.hover();
}

Make sure to add n.getName().equals("NAME")

Not tested but im sure it will be something similar

Thanks, it works!

Make sure to add a delay between hovering and either choose to hover over the same NPC or it might just hover over what's closest (depending how you have it coded), which could change frequently.

  • Author
2 hours ago, Trees said:

Make sure to add a delay between hovering and either choose to hover over the same NPC or it might just hover over what's closest (depending how you have it coded), which could change frequently.

Indeed, I noticed the same. Just a random delay or conditional sleep?

18 hours ago, Prolax said:

Indeed, I noticed the same. Just a random delay or conditional sleep?

Use a delay, in case you need to eat, tele, etc.

Also make sure when you calculate the random delay, you set it to a variable. Otherwise every loop it will recalculate and be more likely to be a shorter delay.

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.