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.

Ignoring dropped item if fire is on the same tile

Featured Replies

I'm working on a script which lights the logs on top of Lumbridge Castle. Quite often the logs respawn before the previous fire may despawn. How would I go about "ignoring" (of sorts) the log if it is on the same tile as the fire?

I'm assuming it could be done at the start of the onLoop, where instead of assigning the entity outside of the onLoop, I reassign it at the start of each iteration. Unsure though.

 Entity log = getGroundItems().closest("Logs");

New to the OSBot API so sorry if this is an ignorant question :/

All feedback would be appreciated.

Edited by R1pple

6 hours ago, R1pple said:

I'm working on a script which lights the logs on top of Lumbridge Castle. Quite often the logs respawn before the previous fire may despawn. How would I go about "ignoring" (of sorts) the log if it is on the same tile as the fire?

I'm assuming it could be done at the start of the onLoop, where instead of assigning the entity outside of the onLoop, I reassign it at the start of each iteration. Unsure though.



 Entity log = getGroundItems().closest("Logs");

New to the OSBot API so sorry if this is an ignorant question :/

All feedback would be appreciated.

To do this you can declare a Filter and than use that Filter to get the closest log.

To declare a Filter to be used you would set it as a variable wherever you need it like so.

Heres a link to the Filter api doc.

private final Filter<RS2Object> logFilter = new Filter<RS2Object>() {
    @Override
    public boolean match(RS2Object rs2Object) {
        return rs2Object.getName().equalsIgnoreCase("logName")
                && getMap().canReach(rs2Object)
                && getObjects().get(rs2Object.getPosition().getX(), rs2Object.getPosition().getY())
                .stream().noneMatch((object) -> object.getName().equalsIgnoreCase("Fire"));
    }
};

You would need to replace the logName string with the name of the log you are looking for.

This Filter will check a few conditions first, if the RS2Object's name matches the supplied string, second it checks to see if you can reach the object lastly, it checks to see if there are no fires at that position.

To use the filter in the onLoop() method you would call getObjects().closest(logFilter) and set that equal to a variable than null check it before acting up on it. Like so.

RS2Object log = getObjects().closest(logFilter);

if (log != null) {
    doLogic();
}

Edited by BravoTaco

  • Author
4 hours ago, BravoTaco said:

To do this you can declare a Filter and than use that Filter to get the closest log.

To declare a Filter to be used you would set it as a variable wherever you need it like so.

Heres a link to the Filter api doc.


private final Filter<RS2Object> logFilter = new Filter<RS2Object>() {
    @Override
    public boolean match(RS2Object rs2Object) {
        return rs2Object.getName().equalsIgnoreCase("logName")
                && getMap().canReach(rs2Object)
                && getObjects().get(rs2Object.getPosition().getX(), rs2Object.getPosition().getY())
                .stream().noneMatch((object) -> object.getName().equalsIgnoreCase("Fire"));
    }
};

You would need to replace the logName string with the name of the log you are looking for.

This Filter will check a few conditions first, if the RS2Object's name matches the supplied string, second it checks to see if you can reach the object lastly, it checks to see if there are no fires at that position.

To use the filter in the onLoop() method you would call getObjects().closest(logFilter) and set that equal to a variable than null check it before acting up on it. Like so.


RS2Object log = getObjects().closest(logFilter);

if (log != null) {
    doLogic();
}

Awesome, thanks for the help. 

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.