pbjfreire 1 Posted April 3, 2020 Hello i started scripting today and decided to write an iron mining script. public class main extends AbstractScript { public int onLoop() { if (getInventory().isFull()) if (getBank().isOpen()) { getBank().depositAllExcept("bronze pickaxe"); }else getBank().open(BankLocation.getNearest()); else { GameObject rock = getGameObjects("Rocks"); if(rock !=null){ rock.interact("Mine"); } } return 1000;} } It is giving me errors but I dont understand whats wrong- Error 1- Error:(12, 42) java: method getNearest in enum org.dreambot.api.methods.container.impl.bank.BankLocation cannot be applied to given types; required: org.dreambot.api.wrappers.interactive.Entity found: no arguments reason: actual and formal argument lists differ in length Error 2- Error:(14, 31) java: method getGameObjects in class org.dreambot.api.methods.MethodContext cannot be applied to given types; required: no arguments found: java.lang.String reason: actual and formal argument lists differ in length Thank you for the help
pbjfreire 1 Author Posted April 3, 2020 I fixed the first error by using the openClosest command instead. The second error still persists however.
Shy 14 Posted April 3, 2020 GameObject rock = getGameObjects().closest(gameObject -> gameObject != null && gameObject.getName().equals("Rocks") && gameObject.hasAction("Mine"));
pbjfreire 1 Author Posted April 3, 2020 Quote GameObject rock = getGameObjects().closest(rock - > rock != null && rock.getName.equals("Rocks") && rock.hasAction("Mine")); import org.dreambot.api.methods.Calculations; 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 = "pedro", name = "Miner", version = 1.0, description = "miner", category = Category.MINING) public class main extends AbstractScript { public void onStart() { log("made by pedro"); } @Override public int onLoop() { if (getInventory().isFull()) if (getBank().isOpen()) { getBank().depositAllExcept("bronze pickaxe"); } else getBank().openClosest(); else { GameObject rock = getGameObjects().closest("Rocks"); if (rock != null) { rock.interact("Mine"); } ; } return Calculations.random(500, 600); } } I ended up getting the script to look like this, but when i put it in the dreambot folder it doesnt show up in the client. Also thank you @Shy
Shy 14 Posted April 3, 2020 Are you sure you are putting the jar in the right folder (Dreambot > Scripts) and are you looking in the right tab in Dreambot (Local Scripts). I copied your code and it shows in Dreambot for me. Also, If you have any other scripts in that folder remove them and see if it still doesn't show because if one script is messed up it will cause all scripts to not show.
pbjfreire 1 Author Posted April 3, 2020 perhaps im compiling the script wrong? My jar file is going into: C:\Users\35193\DreamBot\Scripts here is a screenshot of what im doing http://prntscr.com/rsgvq2
Shy 14 Posted April 3, 2020 I think you need to click the plus button right above the jar file( should say Add Copy of when you hover over it) in that screenshot and then click Module Output and add your Module to the jar file.
pbjfreire 1 Author Posted April 4, 2020 import org.dreambot.api.methods.Calculations; 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 = "pedro", name = "Miner", version = 1.0, description = "miner", category = Category.MINING) public class main extends AbstractScript { public void onStart() { log("made by pedro"); } @Override public int onLoop() { if (getInventory().isFull()) if (getBank().isOpen()) { getBank().depositAllExcept("black pickaxe"); final Area VARROCK = new Area(3174, 3366, 3176, 3368); { getWalking().walk(VARROCK.getCenter()); sleep(Calculations.random(3000, 4000)); } while(!VARROCK.contains(getLocalPlayer())); } else getBank().openClosest(); else { GameObject rock = getGameObjects().closest(11365); if (rock != null) { rock.interact("Mine"); } ; } return Calculations.random(500, 600); } } I tried experimenting with trying to get back to the mining spot after banking, however because the tile is out of reach the bot gets stuck and cant move after a certain point. Thanks for the help. -Pedro
Recommended Posts
Archived
This topic is now archived and is closed to further replies.