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.

Problem with script

Featured Replies

This is the first script I have created, there seems to be problem when running the script. It will only drop items but not chop down the willows near it.

 


import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.api.model.Entity;
import java.awt.*;

@ScriptManifest(author = "SS", info = "First script", name = "test1", version = 0, logo = "")
public class Main1 extends Script {
	
	public static final int[] WOODCUTTING_ID = { 11753, 11752, 11751 }; 
	
    @Override
    public void onStart() {
        log("Let's get started!");
    }
 private enum State {
	 DROP, CHOP, WAIT
 };
    private State getState() {
    	if (!inventory.isFull())
    		return State.DROP;
    	return State.CHOP;
    }
 
 
 @Override
    public int onLoop() throws InterruptedException {
		switch (getState()) {
		case CHOP:
		 if (!myPlayer().isAnimating()) {
			Entity Willow = objects.closest(WOODCUTTING_ID);
			if (Willow != null) {
				Willow.interact("Chop-down");
				sleep(random(25, 30));
			}
		 }
		 break;
		case DROP:
			 inventory.dropAll();
			break;
		case WAIT:
			sleep(random(500, 700));
			break;
		}
		return random(200, 300);
 }
 
    @Override
    public void onExit() {
        log("T!");
    }
 
    @Override
    public void onPaint(Graphics2D g) {
 
    }
 
} 

First attempt 

 

Also is there any other tutorials out there that can improve my skills?

 

Edited by saamabd

if (!inventory.isFull())
    		return State.DROP;

You probably want to drop when inventory.isFull() wink.png

Also, to not drop your axe you can use a filter:

 

inventory.dropAllExcept(item -> item.getName().contains("axe"));

Edited by Flamezzz

Here is some tips: 

 

I added "Willow logs" so it don't drop the important things in the inventory and in the second code i removed the "Chop-down" and added "Chop down"

 inventory.dropAll("Willow logs");
Willow.interact("Chop down");

I think you need cut the logs before dropping.

Kappa

Edited by Ryota

In this line of code:

if (!inventory.isFull())
    		return State.DROP;

We are saying if the inventory is not full, we drop the logs.

And of course, the fallback is the chopping state - which will be returned after every condition is not met (in this case, the inventory is full when we want to chop logs).

 

Solution:

if (inventory.isFullExcept("Bronze axe")) return State.DROP;
return State.CHOP;

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.