July 23, 20196 yr Edit: This may be better suited for Resource Collection, feel free to move if so. Like so many others have said before, be gentle. I've written a few other very simple scripts, this is just one that I feel is decent. It's nothing special, just a simple wheat picker with a static area to pick wheat in the field in Draynor and deposits in Draynor's bank. I used Explv's Lambda expressions for conditional sleeps. I'm sure there's plenty of redundancies or ways to simplify/clean up the code, so if you see a way I'd love to hear it. Thanks. import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.map.Area; @ScriptManifest(name = "[BZG] Wheat Picker v1.0", author = "bumzag", version = 1.0, info = "Picks wheat in Lumbridge and banks in Draynor.", logo = "") public final class WheatPicker extends Script { private Area[] BANK = {Banks.DRAYNOR}; private Area wheatArea = new Area(3116, 3286, 3126, 3277); public void onStart() throws InterruptedException { } @Override public void onExit() { } @Override public int onLoop() throws InterruptedException { if (checkInvIsFull()) dumpInventory(); else { if(!wheatArea.contains(myPosition())) getWalking().webWalk(wheatArea); else { RS2Object wheat = objects.closest("Wheat"); long wheatBefore = getInventory().getAmount("Wheat"); if (wheat != null) { if (!myPlayer().isAnimating()) { if (!myPlayer().isMoving()) { if(wheat.interact("Pick")) Sleep.sleepUntil(() -> getInventory().getAmount("Wheat") > wheatBefore, 5000); } } } } } return(500); } private boolean checkInvIsFull() { return getInventory().isFull(); } private void dumpInventory() throws InterruptedException { if(!Banks.DRAYNOR.contains(myPlayer().getPosition())) { getWalking().webWalk(BANK); Sleep.sleepUntil(() -> Banks.DRAYNOR.contains(myPosition()), 2000); } getBank().open(); Sleep.sleepUntil(() -> getBank().isOpen(), 2000); getBank().depositAll(); Sleep.sleepUntil(() -> getInventory().isEmpty(), 2000); } } Download here Edited July 23, 20196 yr by bumzag
July 23, 20196 yr 47 minutes ago, bumzag said: I'm sure there's plenty of redundancies or ways to simplify/clean up the code, so if you see a way I'd love to hear it. Thanks. Nice script, ive pmed some advice also.
July 23, 20196 yr Author 15 minutes ago, FuryShark said: Nice script, ive pmed some advice also. Thanks for the advice, I pm'd you back and I've updated the code in this thread and the jar file to reflect it.
September 30, 20205 yr Awesome work with this script. I was thinking of implementing very similar for the one near Varrock / the GE. Fun little concept to get into script development.
Create an account or sign in to comment