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.

How to ensure player only chops in specified area?

Featured Replies

I am a newbie working on my first woodcutting script, and everything is going good so far. However, using Objects.closest() sends the player on a wild Tree hunt as the nearest tree is a good distance away. 

How can I ensure that the bot only clicks on Trees inside the designated area? Thanks smile.png

Edited by xxslasherrmx

private RS2Object tree;
private Area someArea = new Area(x1, y1, x2, y2;


public boolean chopTree(){
   List<RS2Object> trees = getObjects().getAll().stream().filter(ob -> ob != null && ob.getName().equalsIgnoreCase("Tree") && canChop(ob)).collect(Collectors.toList());

   if(!myPlayer().isAnimating() && trees.size() > 0){
      RS2Object tree = trees.get(Script.random(trees.size()));
      if(tree.interact("Chop down"){
         //sleep or something
         return true;
      }
   }

   return false;
} 

public boolean canChop(RS2Object tree){
     return someArea.contains(tree);
}

Alternative to @FrostBugs happy.png All code from my head so just double check.

Edited by Extreme Scripts

  • Author
Area trees = new Area(3145, 3492, 3141, 3500);
Entity tree = objects.closest(trees, "Tree");
			if(tree != null && !myPlayer().isAnimating() ){
				tree.interact("Chop Down");

Worked like a charm

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.