Jump to content

if(client.getInventory) Problem


Recommended Posts

Posted

Hello,

I'm new to coding, like today new... I've only just learnt how to install and set up Eclipse! 

 

But now well on my way to (Attempting) to code a Woodcutting script. 

 

I have ran into my first problem it seems... 

 

When trying to write a line of code for:

if ( Client.getInventory().isFull(){

 

}

 

My code doesn't seem to want to pick up the client at all? I feel like I have set up Eclipse well and added the OSB client correct following a guide here, so what could be my issue?

 

Appreciate the help,

 

It's all love

Annotation 2020-05-24 171425.png

Posted (edited)

You don't need to use "Client."

You can use "Inventory.isFull()" or "getInventory().isFull()".

You can do something like this:

    private void drop() throws InterruptedException {
        
    	if  (getInventory().isFull()) {
             getInventory().dropAllExcept("Rune axe");
            sleep(random(50, 105));
			new ConditionalSleep(5000, 600) {
			    @Override
			    public boolean condition() {
			        return (getInventory().isEmptyExcept("Rune axe"));
			    }
			}.sleep();
        } else {
            stop(false);
        }
    }

Furthermore, when using Eclipse you can press "cntrl+space" and it'll give you all possible options for what you're trying. So if you type "getInven" and pres cntrl+space, it'll show "getInventory()", and after you type ".", it'll show everything like "getInventory.isFull" "getInventory.isEmpty", etc.

Edited by Lol_marcus
  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...