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.

Need some help!

Featured Replies

Hey guys, sorry I post so many help topics, but what better way to learn then to ask questions?! I'm trying to check my inventory, and I've read a few tutorials now, even taking notes, but I can't find an exact answer or tutorial explaining how to do this! Basically, I'm making a simple Varrock Yew Cutter, the first thing I want to do is check to make sure the inventory isn't already full! 

 

How would I go about that 

Psuedo Code I wrote, so you guys can follow what exaclty I'm doing, Only need guidance on how to check the current status of my inventory and if it is full!

 

I have another question, here is my code so far, wondering why my conditional sleep on cut isn't working? 

Spoiler

import org.osbot.rs07.api.Bank;
import org.osbot.rs07.api.Inventory;
import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.api.map.constants.Banks;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.api.util.ItemContainer;
import org.osbot.rs07.script.Script;

import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;

import java.awt.*;

@ScriptManifest(author = "MySQLi", info = "Varrock Yew Cutter / Banker", name = "SqlYewCutter", version = 1.0, logo = "")

public class Main extends Script {

    @Override
    public void onStart() {
        log("Enjoy cutting yews!");
        //Code here will execute before the loop is started
    }

    

    @Override
    public void onExit() {
        log("Thank you for supporting my script!");
        //Code here will execute after the script ends
    }

    private void bank() throws InterruptedException{
        if(inventory.isFull() && !Banks.VARROCK_WEST.contains(myPosition())){
            getWalking().webWalk(Banks.VARROCK_WEST);
        }
        else if (!getBank().isOpen()){
            getBank().open();
            getBank().depositAll("Yew Logs");
        }
        else{
            getWalking().walk(new Position(3247,3472,0));
        }
    }
  
    
    private void cut(){
            RS2Object yew = getObjects().closest("Yew");
            if(yew != null && yew.interact("Chop down"));
            new ConditionalSleep(5000){
                public boolean condition(){
                    return myPlayer().isAnimating() || !yew.exists();
                }
            }.sleep();
    }

    public boolean canCutTrees(){
        return myPlayer().isOnScreen();
        
    }
    
    
    public int onLoop() throws InterruptedException{
        if(canCutTrees()){
            cut();
        }
        else{
            bank();
        }
    
        
        return random (150,200); //The amount of time in milliseconds before the loop starts over
    }

    @Override
    public void onPaint(Graphics2D g) {
        //This is where you will put your code for paint(s)
    }

}

Edited by MySQLi

if(inventory.isFull()){
// code here whatever you want it do do if inv is full
}

Or if you want a seperate class for it..

 

	public dropItems(MethodProvider api) {
		super(api);
	}

	@Override
	public boolean canProcess() {
		return api.getInventory().isFull();
	}

	@Override
	public void process(){
		api.log("Dropping items...");
		api.getInventory().dropAll("Items to drop","Items to drop");
		new ConditionalSleep(MethodProvider.random(2000,3000)) {
            public boolean condition() throws InterruptedException {
            	return api.getInventory().isEmpty();
            }
         }.sleep();
	}
}

 

Edited by Void

Check if inventory is full:

if (getInventory().isFull()) ...

Deposit all except axe:

getBank().depositAllExcept((Filter<Item>) item -> item.getName().contains("axe"));

 

Edited by Eliot

  • Author
50 minutes ago, Eliot said:

Check if inventory is full:


if (getInventory().isFull()) ...

Deposit all except axe:


getBank().depositAllExcept((Filter<Item>) item -> item.getName().contains("axe"));

 

Thanks man, got that working, got one more question if you have a second, posted it up top!

Just a tip, you probably want some sleeps inbetween each of your actions, ie:

  getBank().open();        

sleep(random(100,500));

    getBank().depositAll("Yew Logs");

You need brackets

if(yew != null && yew.interact("Chop down")) {
            new ConditionalSleep(5000){
                public boolean condition(){
                    return myPlayer().isAnimating() || !yew.exists();
                }
            }.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.