Zynava Posted November 2, 2021 Share Posted November 2, 2021 (edited) Third script release! 🥳 Do you like my free scripts? Please show your support and Buy Me a Coffee! ☕ This one is really simple. Have empty jugs in your bank & bot will withdraw, fill them at pump, bank, rinse & repeat. CODE:  import com.epicbot.api.shared.APIContext; import com.epicbot.api.shared.GameType; import com.epicbot.api.shared.entity.ItemWidget; import com.epicbot.api.shared.entity.SceneObject; import com.epicbot.api.shared.methods.*; import com.epicbot.api.shared.model.Area; import com.epicbot.api.shared.script.LoopScript; import com.epicbot.api.shared.script.ScriptManifest; import com.epicbot.api.shared.util.paint.frame.PaintFrame; import com.epicbot.api.shared.util.time.Time; import com.epicbot.api.shared.webwalking.model.RSBank; import java.awt.*; @ScriptManifest(name = "Water Jug Filler by Zynava", gameType = GameType.OS) public class WaterJugFiller extends LoopScript { /***BEGIN VARIABLES***/ private String status = "Starting"; private final Area PUMP_POS = new Area(2949, 3382, 2949, 3383); IBankAPI myBank() { return getAPIContext().bank(); } IInventoryAPI myInv() { return getAPIContext().inventory(); } IWebWalkingAPI webWalking() { return getAPIContext().webWalking(); } IWalkingAPI walking() { return getAPIContext().walking(); } ILocalPlayerAPI localPosition() { return getAPIContext().localPlayer(); } IObjectsAPI localObject() { return getAPIContext().objects(); } /***END VARIABLES***/ @Override public boolean onStart(String... strings) { return true; } @Override protected int loop() { //On script start, if inventory is empty... if(myInv().isEmpty()) { setStatus("Banking"); bank(); } // If inv if full, bank if(myInv().isFull()) { if(myInv().onlyContains("Jug of water")) { setStatus("Banking"); bank(); } else if(myInv().contains("Jug") && !PUMP_POS.contains(localPosition().getLocation())) { webWalking().walkTo(PUMP_POS.getRandomTile()); } else if(myInv().contains("Jug") && PUMP_POS.contains(localPosition().getLocation())) { SceneObject PUMP = getPump(); ItemWidget jug = myInv().getItem("Jug"); if(PUMP != null) { setStatus("Filling jugs"); if(jug != null) { Time.sleep(2000, jug::interact); Time.sleep(2000, PUMP::interact); } } } // If moving, don't do anything } else if(localPosition().isMoving()) { Time.sleep(1000, () -> !localPosition().isMoving()); // If out of run and we have some to use, enable run } else if(walking().isRunEnabled() && walking().getRunEnergy() > 15) { if(walking().setRun(true)) { Time.sleep(2000, () -> walking().isRunEnabled()); } } return 100; } public void setStatus(String status){ this.status = status; } public void bank() { if(myBank().isOpen()) { if(!myInv().onlyContains("Jug")) { myBank().depositInventory(); Time.sleep(2000, () -> myInv().isEmpty()); } else { if(myBank().withdrawAll("Jug")) { Time.sleep(2000, () -> myInv().onlyContains("Jug")); } else { Time.sleep(2000, () -> myBank().close()); Time.sleep(4000, () -> getAPIContext().game().logout()); getAPIContext().script().stop("Stopping script"); } } } else { webWalking().walkTo(RSBank.FALADOR_WEST.getTile()); myBank().open(); } } public SceneObject getPump() { return localObject().query().nameMatches("Waterpump").results().nearest(); } @Override protected void onPaint(Graphics2D g, APIContext ctx) { PaintFrame frame = new PaintFrame("Water Jug Filler by Zynava"); frame.addLine("status", status); frame.draw(g, 0, 170, ctx); } }  Edited November 8, 2021 by Zynava 1 Quote Link to comment Share on other sites More sharing options...
Sellout Posted November 2, 2021 Share Posted November 2, 2021 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.