ProBotterIamN 11 Share Posted November 10, 2017 So i am working on a simple script to learn the basics and so on so now i am far but getting errors package cabbagepicker; import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.container.impl.bank.BankLocation; import org.dreambot.api.methods.map.Area; import org.dreambot.api.methods.map.Tile; import org.dreambot.api.script.AbstractScript; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.script.Category; import org.dreambot.api.wrappers.interactive.GameObject; @ScriptManifest(author = "ProBotterIamN", name = "Cabbage Picker", version = 1.0, description = "Will get you to Level 99 Cabbage Picking", category = Category.MONEYMAKING) public class cabbagepicker extends AbstractScript { public void onStart() { log("Starting Script!"); log("Enjoy getting 99 Cabbage Picking!"); log("Leave feedback!"); } private enum State { BANK, WALK_FIELD, WALK_BOX, PICK, WAIT }; private State getState() { getGameObjects().closest("Bank Deposit Box"); if (!getInventory().isFull()) return State.BANK; getGameObjects().closest("Cabbage"); if (!getInventory().isEmpty()) return State.PICK; return State.WAIT; } public void onExit() { log("Hope you reached level 99 Cabbage Picking!"); log("Leave Feedback plx!"); } Tile deposit = new Tile(3045, 3235); // Deposit Box Tile cabbage = new Tile(3052, 384); //Field @Override public int onLoop() { switch (getState()) { case PICK: if(cabbage.distance(getLocalPlayer()) <= 4) { //Checks if Cabbage is in a 4 Tile range of char if(!getInventory().isEmpty()) { //Checks if inventory is empty log("Picking Vegtables!"); //Puts Text In Log cabbage.interact("Pick");//Interacts with Cabbage }else{ log("Walking to Field!"); //Status: Walking to box getWalking().walk(cabbage.getRandomizedTile()); sleep(Calculations.random(1827,2482)); } } case BANK: if(getBank().isOpen()){ getBank().depositAllItems(); sleep(Calculations.random(900,1200)); } else{ getBank().open(); Calculations.random(900,1200); } break; case WAIT: sleep(300); break; WALK: getWalking().walk(cabbage.getRandomizedTile()); if(!getInventory().isEmpty()) { log("Walking to Field!"); } }Calculations.random(2400,2800); }else{ if(field.contains(getLocalPlayer())){ final GameObject gate = getGameObjects().closest(gate){ public boolean match(GameObject go){ if(go == null || go.getName() == null) return false; if(!go.getName().equals("Gate")) return false; if(!go.getTile().equals(new Tile(3253,3266,0))) return false; return true; } } return Calculations.random(500, 600); } } So the errors are here case PICK: if(cabbage.distance(getLocalPlayer()) <= 4) { //Checks if Cabbage is in a 4 Tile range of char if(!getInventory().isEmpty()) { //Checks if inventory is empty log("Picking Vegtables!"); //Puts Text In Log cabbage.interact("Pick");//Interacts with Cabbage }else{ log("Walking to Field!"); //Status: Walking to box getWalking().walk(cabbage.getRandomizedTile()); sleep(Calculations.random(1827,2482)); } } and here case WAIT: sleep(300); break; WALK: getWalking().walk(cabbage.getRandomizedTile()); if(!getInventory().isEmpty()) { log("Walking to Field!"); } }Calculations.random(2400,2800); }else{ if(field.contains(getLocalPlayer())){ final GameObject gate = getGameObjects().closest(gate){ public boolean match(GameObject go){ if(go == null || go.getName() == null) return false; if(!go.getName().equals("Gate")) return false; if(!go.getTile().equals(new Tile(3253,3266,0))) return false; return true; } } return Calculations.random(500, 600); } } Ok now i just removed all the lines about picking and interacting so all thats left in the script is the walking instead of either walking to the depo box in port sarim or the cabbage field it walks to the bank in draynor lol Link to comment Share on other sites More sharing options...
Koschei 147 Share Posted November 10, 2017 For one your brackets are misplaced, another would be your checking if the inventory is not empty and your comment says something different. if(cabbage.distance(getLocalPlayer()) <= 4) { //Checks if Cabbage is in a 4 Tile range of char if(!getInventory().isEmpty()) { //Checks if inventory is empty log("Picking Vegtables!"); //Puts Text In Log cabbage.interact("Pick");//Interacts with Cabbage }else{ log("Walking to Field!"); //Status: Walking to box getWalking().walk(cabbage.getRandomizedTile()); sleep(Calculations.random(1827,2482)); } } Also why do you call gameobjects twice for no reason getGameObjects().closest("Bank Deposit Box"); if (!getInventory().isFull()) return State.BANK; getGameObjects().closest("Cabbage"); if (!getInventory().isEmpty()) return State.PICK; return State.WAIT; } Link to comment Share on other sites More sharing options...
ProBotterIamN 11 Author Share Posted November 10, 2017 For one your brackets are misplaced, another would be your checking if the inventory is not empty and your comment says something different. if(cabbage.distance(getLocalPlayer()) <= 4) { //Checks if Cabbage is in a 4 Tile range of char if(!getInventory().isEmpty()) { //Checks if inventory is empty log("Picking Vegtables!"); //Puts Text In Log cabbage.interact("Pick");//Interacts with Cabbage }else{ log("Walking to Field!"); //Status: Walking to box getWalking().walk(cabbage.getRandomizedTile()); sleep(Calculations.random(1827,2482)); } } Also why do you call gameobjects twice for no reason getGameObjects().closest("Bank Deposit Box"); if (!getInventory().isFull()) return State.BANK; getGameObjects().closest("Cabbage"); if (!getInventory().isEmpty()) return State.PICK; return State.WAIT; } aye lel but the weird part is the walk method i have now walks to bank in draynor instead of the depo box i was testing the walking after i removed some things anyways gonna try it out once soccer is done Link to comment Share on other sites More sharing options...
swift 22 Share Posted November 10, 2017 aye lel but the weird part is the walk method i have now walks to bank in draynor instead of the depo box i was testing the walking after i removed some things anyways gonna try it out once soccer is done Try using an area instead of a tile. Link to comment Share on other sites More sharing options...
ProBotterIamN 11 Author Share Posted November 11, 2017 Try using an area instead of a tile. script is functional not really what i want it to be but i can improve it after a certain time Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.