March 17, 20169 yr 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.
March 17, 20169 yr Author getInventory().isFull() { getInventory().dropAll(); the getInventory() part is still undefined
March 17, 20169 yr 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 March 17, 20169 yr by MegaManAlpha
March 17, 20169 yr Author 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.
March 17, 20169 yr 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 March 17, 20169 yr by MegaManAlpha
March 17, 20169 yr 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) {
March 17, 20169 yr Author 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.
March 17, 20169 yr 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 March 17, 20169 yr by MegaManAlpha
March 17, 20169 yr 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?
March 17, 20169 yr 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 March 17, 20169 yr by MegaManAlpha
March 17, 20169 yr 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.
March 17, 20169 yr 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 March 17, 20169 yr by MegaManAlpha
March 17, 20169 yr 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 March 17, 20169 yr by FrostBug
Create an account or sign in to comment