Jump to content

if(client.getInventory) Problem


Conscious Realm

Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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