Skip 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.

Chop N Burn [Tree's]

Featured Replies

Simple Woodcutter & Firemaker for Tree's. Wondering how I can make bot move based off of game message "You can't light a fire here." Any help would be appreciated. :)

Edited by Imthabawse

public void onMessage(Message message) throws java.lang.InterruptedException{
		if (message.getType() == Message.MessageType.GAME) {
			String txt = message.getMessage().toLowerCase();
			if (txt.contains("you can't light a fire here.") {
				movePosition = true;
			}
		}
	}

 

    private void lightFire() {
        if (standingOnFire()) {
            getEmptyPosition().ifPresent(position -> {
                WalkingEvent walkingEvent = new WalkingEvent(position);
                walkingEvent.setMinDistanceThreshold(0);
                execute(walkingEvent);
            });
        } else if (!"Tinderbox".equals(getInventory().getSelectedItemName())) {
            getInventory().getItem("Tinderbox").interact("Use");
        } else if (getInventory().getItem("Logs").interact()) {
            Position playerPos = myPosition();
            Sleep.sleepUntil(() -> !myPosition().equals(playerPos), 10_000, 600);
        }
    }

    private boolean standingOnFire() {
        return getObjects().singleFilter(getObjects().getAll(), obj -> obj.getPosition().equals(myPosition()) && obj.getName().equals("Fire")) != null;
    }

    private Optional<Position> getEmptyPosition() {
        List<Position> allPositions = myPlayer().getArea(10).getPositions();

        // Remove any position with an object (except ground decorations, as they can be walked on)
        for (RS2Object object : getObjects().getAll()) {
            if (object instanceof GroundDecoration) {
                continue;
            }
            allPositions.removeIf(position -> object.getPosition().equals(position));
        }

        allPositions.removeIf(position -> !getMap().canReach(position));

        return allPositions.stream().min(Comparator.comparingInt(p -> myPosition().distance(p)));
    }

Take a look at this! From @Explv's AIO.

On 5/1/2019 at 1:06 PM, FuryShark said:

public void onMessage(Message message) throws java.lang.InterruptedException{
		if (message.getType() == Message.MessageType.GAME) {
			String txt = message.getMessage().toLowerCase();
			if (txt.contains("you can't light a fire here.") {
				movePosition = true;
			}
		}
	}

 

Using onMessage should be avoided, it uses a seperate thread and will be  constantly listening / checking if the message is there, this takes up more CPU no? Correct me if I'm wrong

 

Always go with as few threads as possible and make use of private code. EXPLVs code above seems to be more efficient for anyone reading this:boge:

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.