March 23, 20196 yr Mines ore's and banks them. Simple. Planning on getting into GUI to add option's like drop OR bank. Any tip's on how to go about that would be helpful! I also know there are guides on here and will be reading them as well. CODE: import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; @ScriptManifest(name = "Iron miner", logo = "", version = 1, author = "Imthabawse", info = "Mine & Drop Iron ore") public class Iron extends Script { private Area ironArea = new Area(3288, 3371, 3284, 3367); private void bank() { if (Banks.VARROCK_EAST.contains(myPlayer())) { RS2Object banker = getObjects().closest("Bank booth"); log("In bank.. getting closest banker."); if (banker != null) { banker.interact("Bank"); log("Banking.."); new ConditionalSleep(2000) { @Override public boolean condition() { return bank.isOpen() && getInventory().isEmpty(); } }.sleep(); } if (bank.isOpen()) { bank.depositAll(); } } else { if (!Banks.VARROCK_EAST.contains(myPlayer())) { getWalking().webWalk(Banks.VARROCK_EAST); log("Not in bank.. walking there."); } } } private void mineIron() { if (ironArea.contains(myPlayer())) { if (!myPlayer().isAnimating()) { if (!myPlayer().isMoving()) { if (!getInventory().isFull()) { RS2Object ironore = getObjects().closest(7488); log("Getting closest iron ore."); if (ironore != null) { ironore.interact("Mine"); log("Mining.."); new ConditionalSleep(3500) { @Override public boolean condition() { return myPlayer().isAnimating() && myPlayer().isMoving(); } }.sleep(); } } } } }else{ if(!ironArea.contains(myPlayer())) { log("Walking to mining area. "); getWalking().webWalk(ironArea); } } } @Override public int onLoop() { if(getInventory().isFull()) { log("Inventory FULL banking."); bank(); }else{ mineIron(); } return 1500; } }
March 23, 20196 yr Nice work, no need get the bank booth as an object, use getBank().open() instead. Also add some verifications, instead of: if (bank.isOpen()) { bank.depositAll(); } Do something like: if (bank.isOpen()) { if(bank.depositAll()) { //Here you should sleep untill inventory is empty } } Do stuff like this throughout your code. Also, in the confitional sleep in the bank method you use: return bank.isOpen() && getInventory().isEmpty(); When sleeping after just opening the bank, seperate this to just bank.isOpen() and then later verify the inventory is empty. The way it is now I am pretty sure it will always sleep on the first time you one the bank.
March 23, 20196 yr Author @HunterRS Thanks for the quick reply. I'll have to play around with this but for now it seems to work alright. ?
Create an account or sign in to comment