Jump to content

Undefined i need help


znaation

Recommended Posts

hello im trying to make my first script just for WC so im making it to see if my inventory is full so it can go bank but it keeps telling me that "The method Inventroy() is undefined for the type Client" im not sure what i need to fix i have already imported inventory.

 

type inventory.

 

so the code will be: if(inventory.isFull())

 

Other example:

bank.open(); // open the bank

bank.isOpen() // to see if its open or not

bank.close

if(inventory.contains("Logs"))

inventory.isEmpty()

 

objects.closest("Tree").interact("Chop-down");

 

walking.walk(x, y)

 

 

Also make sure where it says:

 

public class NAME {

 

change it to

 

public class NAME extends Script {

Edited by MegaManAlpha
Link to comment
Share on other sites

type inventory.

 

so the code will be: if(inventory.isFull())

 

Other example:

bank.open(); // open the bank

bank.isOpen() // to see if its open or not

bank.close

if(inventory.contains("Logs"))

inventory.isEmpty()

 

objects.closest("Tree").interact("Chop-down");

 

walking.walk(x, y)

 

 

Also make sure where it says:

 

public class NAME {

 

change it to

 

public class NAME extends Script {

here is what i have so far.

package Woodcutter;
 
import java.awt.Graphics;
 
import org.osbot.rs07.api.Inventory;
import org.osbot.rs07.script.MethodProvider;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
 
 
@ScriptManifest(author = "", info = "", logo = "", name = "Woodcutter", version = 0.1)
public class Woodcutter extends Script{
 
 
public void onStart(){
 
}
 
 
//Code to be Excecuted at the end
public void onExit(){
 
 } //Code to loop the Seconds
public int onLoop(){
 
Inventory inven = client.getInventroy();
 
if(!inven.isFull()){
 
 
 
 
}else {
}
 
 
 
return 50;
}
//Paint
public void onPaint(Graphics g){
 
}
}
but like i said the inventory needs to be defined in a form i think or it tells me to add a cast to it.
Link to comment
Share on other sites

 

I already told you.

 

Where it says in your code:

Inventory inven = client.getInventroy();
 
if(!inven.isFull()){

 

put instead:

if(!inventory.isFull()){

 

 

Do not try to create an Inventory inven object, remove that line.

 

 

1) Remove that line

2) change !inven to !inventory

Edited by MegaManAlpha
  • Like 1
Link to comment
Share on other sites

 

here is what i have so far.

package Woodcutter;
 
import java.awt.Graphics;
 
import org.osbot.rs07.api.Inventory;
import org.osbot.rs07.script.MethodProvider;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
 
 
@ScriptManifest(author = "", info = "", logo = "", name = "Woodcutter", version = 0.1)
public class Woodcutter extends Script{
 
 
public void onStart(){
 
}
 
 
//Code to be Excecuted at the end
public void onExit(){
 
 } //Code to loop the Seconds
public int onLoop(){
 
Inventory inven = client.getInventroy();
 
if(!inven.isFull()){
 
 
 
 
}else {
}
 
 
 
return 50;
}
//Paint
public void onPaint(Graphics g){
 
}
}
but like i said the inventory needs to be defined in a form i think or it tells me to add a cast to it.

 

 

remove the inventory invent .....

 

just put the if (getInventory().isFull) {

Link to comment
Share on other sites

I already told you.

 

Where it says in your code:

Inventory inven = client.getInventroy();
 
if(!inven.isFull()){

 

put instead:

if(!inventory.isFull()){

 

 

Do not try to create an Inventory inven object, remove that line.

 

 

1) Remove that line

2) change !inven to !inventory

oh okay i get it thank you. and i apologize i didnt get what u were trying to say the first time.

Link to comment
Share on other sites

oh okay i get it thank you. and i apologize i didnt get what u were trying to say the first time.

 

It's ok. I will be online on the OSBot Chat Box tomorrow if you need more help, it should be easier than making a thread.

 

Also try typing:

this.

 

when you type this.  your software will list all the options to choose from like: inventory, bank, etc. Its useful.

Edited by MegaManAlpha
Link to comment
Share on other sites

remove the inventory invent .....

 

just put the if (getInventory().isFull) {

 

I already told you.

 

Where it says in your code:

Inventory inven = client.getInventroy();
 
if(!inven.isFull()){

 

put instead:

if(!inventory.isFull()){

 

 

Do not try to create an Inventory inven object, remove that line.

 

 

1) Remove that line

2) change !inven to !inventory

 

It's ugly, but it makes no difference. What he's doing is the exact same thing, so this is not the cause of error.

@OP have you imported the latest client library in your project?

  • Like 1
Link to comment
Share on other sites

It's ugly, but it makes no difference. What he's doing is the exact same thing, so this is not the cause of error.

@OP have you imported the latest client library in your project?

 

FrostBug you are getting hung up on the: inventory vs getInventory()

 

The OP was not doing that. Check the source code he provided (all of it)

 

He was trying to instantiate a new Inventory object. I told him to scrap that, and just call the already declared inventory object, available via 2 methods: .inventory   or  .getInventory()   either of those replacements would have fixed his error

 

His issue has already been resolved.

Edited by MegaManAlpha
Link to comment
Share on other sites

FrostBug you are getting hung up on the: inventory vs getInventory()

 

The OP was not doing that. Check the source code he provided (all of it)

 

He was trying to instantiate a new Inventory object. I told him to scrap that, and just call the already declared inventory object, available via 2 methods: .inventory   or  .getInventory()   either of those replacements would have fixed his error

 

His issue has already been resolved.

 

Inventory inven = client.getInventroy();

^

This does not create a new inventory object, but a new reference to the same object. It will work just as well as inventory or getInventory(). Despite being pointless.

 

Link to comment
Share on other sites

Inventory inven = client.getInventroy();

^

It will work just as well as inventory or getInventory(). Despite being pointless.

 

 

Inventory i = client.getInventory();

 

cannot find symbol

 

try not to get hung up on the .inventory vs .getInventory() - you are missing the actual error in his code

Edited by MegaManAlpha
Link to comment
Share on other sites

Inventory i = client.getInventory();

 

cannot find symbol

 

try not to get hung up on the .inventory vs .getInventory() - you are missing the actual error in his code

 

lol at the inventory vs. getInventory() thing. Not sure why you think I care about that

 

But you are correct, I thought Client extended API like all the other API classes, but it does not. Had it been anything but client (mouse, npcs, objects, players etc.) it would have been perfectly valid.

Edited by FrostBug
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...