Durky Posted January 14, 2019 Share Posted January 14, 2019 (edited) I whipped this up tonight, start it in any bank with or without the compost or the saltpetre in your inventory. i know other people have made this, i just don't run other peoples free scripts no offense to anyone. Heres my version. import java.awt.Graphics2D; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; @ScriptManifest(author = "Durky", name = "Sulphurous Fertiliser", info = "Combines compost and Saltpetre", version = 1.0, logo = "") public class main extends Script { private String Sulphurousfertiliser = "Sulphurous fertiliser"; private String Compost = "Compost"; private String Saltpetre = "Saltpetre"; private boolean opened = false; private boolean lastInventory = false; private int leftOverAmount = 14; private long startTime; private int amountMade = 0; private String status; private State playerState = State.COMBINING; @Override public void onStart() { startTime = System.currentTimeMillis(); status = "Starting up!"; } public enum State { BANKING, COMBINING, SHUTTING_DOWN; } private int sleepDelay = 2500; private long iterations; @Override public int onLoop() throws InterruptedException { switch (playerState) { case BANKING: if (!opened) { log("attempting to open bank."); status = "Opening Bank, getting more!"; opened = true; if (!getBank().isOpen()) { getBank().open(); new ConditionalSleep(5000) { public boolean condition() { return getBank().isOpen(); } }.sleep(); } } if (getBank().isOpen()) { status = "Removing Items from the bank!"; if (getInventory().contains(Sulphurousfertiliser)) { getBank().depositAll(); amountMade += getInventory().getAmount(Sulphurousfertiliser); } sleep(random(500, 1000)); if (getBank().getAmount(Saltpetre) > 13) { getBank().withdraw(Saltpetre, 14); } else { leftOverAmount = (int) getBank().getAmount(Saltpetre); getBank().withdraw(Saltpetre, leftOverAmount); lastInventory = true; log("down to the last " + leftOverAmount + " saltpetre"); status = "Last Inventory! out of saltpetre"; } sleep(random(500, 1000)); if (getBank().getAmount(Compost) > 13) { getBank().withdraw(Compost, 14); } else { leftOverAmount = (int) getBank().getAmount(Compost); getBank().withdraw(Compost, leftOverAmount); lastInventory = true; log("down to the last " + leftOverAmount + " compost"); status = "Last Inventory! out of compost"; } getBank().close(); opened = false; setPlayerState(State.COMBINING); } break; case COMBINING: if (!getInventory().isEmpty()) { if (getInventory().contains(Compost) && getInventory().contains(Saltpetre)) { getInventory().getItem(Compost).interact("Use"); sleep(250); getInventory().getItem(Saltpetre).interact("Use"); iterations = getInventory().getAmount(Compost) >= getInventory().getAmount(Saltpetre) ? getInventory().getAmount(Compost) : getInventory().getAmount(Saltpetre); status = "Combining the materials!"; amountMade += iterations; sleep((int) sleepDelay * iterations); setPlayerState(lastInventory ? State.SHUTTING_DOWN : State.BANKING); } else setPlayerState(State.BANKING); } else setPlayerState(State.BANKING); break; case SHUTTING_DOWN: log("Shutting down, thanks!"); stop(); break; } return 500; } public State getPlayerState() { return playerState; } public void setPlayerState(State playerState) { this.playerState = playerState; } @Override public void onPaint(Graphics2D g) { g.drawString("Run time: " + formatTime(System.currentTimeMillis() - startTime), 10, 304); g.drawString("Bot Status: " + status, 10, 320); g.drawString("You have currently made " + amountMade + " Sulphurous fertiliser!", 10, 334); } public final String formatTime(final long ms) { long s = ms / 1000, m = s / 60, h = m / 60, d = h / 24; s %= 60; m %= 60; h %= 24; return d > 0 ? String.format("%02d:%02d:%02d:%02d", d, h, m, s) : h > 0 ? String.format("%02d:%02d:%02d", h, m, s) : String.format("%02d:%02d", m, s); } } SulphurousFertiliser.jar Edited January 14, 2019 by Durky 1 Quote Link to comment Share on other sites More sharing options...
Dutchsmoker420 Posted January 13, 2022 Share Posted January 13, 2022 thnx for the script bro it still works, i always hated to do this myself. Quote Link to comment Share on other sites More sharing options...