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.

My first Woodcutting Script 1-15

Featured Replies

import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.map.constants.Banks;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.model.Player;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;

@ScriptManifest(author = "Duhrealtim", name = "1-15 WoodCutter", info = "My First Script", version = 0.1, logo = "")
public final class Woodcut extends Script {

  //Areas
  private final Area treeArea = new Area(3197, 3205, 3180, 3229);
  private final Area lumbridgeBankArea = new Area(3208, 3218, 3209, 3219);


  @Override
  public int onLoop() throws InterruptedException {
    //Keeps looping
    if (getInventory().getEmptySlotCount() != 0) {
      RS2Object tree = getObjects().closest(obj -> obj != null && obj.getName().equals("Tree")
              && getMap().canReach(obj)); //tree to chop
      if (!myPlayer().isAnimating()) {
        if (tree != null) {
          if (tree.interact("Chop down")) {
            new ConditionalSleep(5000, 2000) {
              @Override
              public boolean condition() throws InterruptedException {
                return false;
              }
            }.sleep();
          }
        }
      } else if (tree == null) { // if it dont see tree it moves
        getCamera().toEntity(tree);
        log("Searching for a tree");
        if (getWalking().webWalk(treeArea)) {
          log("Walking to trees");
          new ConditionalSleep(5100, 6100) {
            @Override
            public boolean condition() throws InterruptedException {
              return false;
            }
          };
        }
      }
    } else {
      log("Inventory Full."); //Walks to bank
      if (getWalking().webWalk(Banks.LUMBRIDGE_UPPER)) { //What bank it banks at.
        log("Walking to bank...");
        new ConditionalSleep(5000, 1000) {
          @Override
          public boolean condition() throws InterruptedException {
            return true;
          }
        };
        Entity depoBox = objects.closest("Bank deposit box"); //Opens deposit box and deposits logs.
        if (depoBox != null) {
          new ConditionalSleep(2000, 5000) {
            @Override
            public boolean condition() throws InterruptedException {
              return true;
            }
          };
          if (depoBox.interact("Deposit")) {
            while (!depositBox.isOpen()) {
              new ConditionalSleep(2000, 5000) {
                @Override
                public boolean condition() throws InterruptedException {
                  return true;
                }
              };
            }
            depositBox.depositAllExcept("Bronze axe");
getWalking().webWalk(treeArea);
          }
        }
      }
    }
    return 1000;
  }



  }

 

 

 

My very first script. Still trying to learn how to make it progressive.

If you can compile it into a .jar for me I'll give it a try and let you know any bugs I come across. 

  • Author

I can send you a link to the new version of it. I recently changed it to willows and made it powerchop. 

Start it at draynor next to bank. 

WoodCutter.jar

Take a look at ConditionalSleep's Api docs again, your usage is incorrect. https://osbot.org/api/org/osbot/rs07/utility/ConditionalSleep.html. You really need to be overriding condition() and using that to determine when to stop sleeping. Right now you are just sleeping and hoping 5000ms is enough if you CS is returning false. Also every ConditionalSleep where you are just returning true imminently does nothing. 

For example

if (tree.interact("Chop down")) {
  new ConditionalSleep(5000, 2000) {
    @Override
      public boolean condition() throws InterruptedException {
      return false;
    }
  }.sleep();
}

I think your intention is to attempt to chop down a tree, then sleep until the tree is chopped down. In which case it should be something like...
 

if (tree.interact("Chop down")) {
  new ConditionalSleep(5000, 2000) {
    @Override
    public boolean condition() throws InterruptedException {
		// As long condition() resolves to false, Conditional sleep will continue sleeping (if it hasn't been 5seconds yet).
		// When you are woodcutting, myPlayer().isAnimating() returns true. 
		// I want to my script to wait until the woodcutting animation is complete (meaning the tree is chopped down)
		// so by !myPlayer().isAnimating() (note the ! in the beginning)
		// The script will wait until your character stops chopping (aka stops animating) before checking for the next tree. 
    	
		return !myPlayer().isAnimating(); 
    }
  }.sleep();
}

 

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.