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.

Get current object myPlayer is interacting with

Featured Replies

Hi

I am trying to figure out how to get the current RS2Object that the bot is interacting with.

I am looking for something like;

myPlayer().isInteracting(getObjects().closest(getObjects().getAll());

 

If someone knows a way to do this, feel free to comment :)

  • Author
1 hour ago, Nbacon said:

Hey pigfarmer,

I don't know if this works 


 public RS2Object something() {


        for (RS2Object x:getObjects().getAll()) {
            if (myPlayer().isInteracting((org.osbot.rs07.api.model.Character<?>) x)){
                return x;
            }

        }
        
        return null;
    }

Also you might want to put questions in https://osbot.org/forum/forum/249-scripting-help/ not https://osbot.org/forum/forum/251-snippets/ 

 

This dose not work unfortunately:(

It seems like you can not cast a RS2Object to a Character :(

Anyone else that knows who this could be done???

  • Author
11 minutes ago, Nbacon said:

what are doing? does it it have an inteface or animation? 

I just want to know if the bot is interacting with a object and if so, what is the object?

On 6/9/2020 at 3:08 PM, pigfarmer said:

I just want to know if the bot is interacting with a object and if so, what is the object?

Try this

Entity interacting = myPlayer().getInteracting();
if (interacting != null) {
    if (interacting instanceof RS2Object) {
        RS2Object object = (RS2Object) interacting;
    } else if (interacting instanceof NPC) {
        NPC npc = (NPC) interacting;
    }
}
  • 7 months later...
On 6/12/2020 at 9:03 AM, BravoTaco said:

Try this


Entity interacting = myPlayer().getInteracting();
if (interacting != null) {
    if (interacting instanceof RS2Object) {
        RS2Object object = (RS2Object) interacting;
    } else if (interacting instanceof NPC) {
        NPC npc = (NPC) interacting;
    }
}

Did this work?

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.