smh1 0 Share Posted January 8, 2021 import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.container.impl.Inventory; import org.dreambot.api.methods.container.impl.bank.Bank; import org.dreambot.api.methods.input.Keyboard; import org.dreambot.api.methods.interactive.NPCs; import org.dreambot.api.script.AbstractScript; import org.dreambot.api.script.Category; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.wrappers.interactive.NPC; @ScriptManifest( author = "smh1", description = "Cooker", category = Category.COOKING, version = 0.01, name = "Speed Cooker" ) public class SpeedCooker extends AbstractScript { int[] order = {1, 2, 3, 4, 5, 6 ,7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 ,19 ,20 ,21 ,22 , 23, 24, 25, 26, 27}; public int uShark = 383; public int shark = 385; public int banker = 3194; public int fire = 26185; NPC bankMan = NPCs.closest(banker); State state; @Override public int onLoop() { switch (getState()) { case BANKING: sleep(Calculations.random(100, 10000)); if (Inventory.isEmpty() || Inventory.containsAll(shark) && !Bank.isOpen()) bankMan.interact("Bank"); sleepUntil(() -> Bank.isOpen(), Calculations.random(500, 3250)); Bank.depositAllItems(); sleepUntil(() -> Inventory.isEmpty(), Calculations.random(1500, 5000)); Bank.withdrawAll(uShark); sleepUntil(() -> Inventory.isFull(), Calculations.random(500, 2050)); if (Inventory.containsAll(uShark)) Bank.close(); break; case DROPPING: for (int i : order) { Keyboard.holdShift(()-> Inventory.isEmpty(), 1000); Inventory.getItemInSlot(i).interact(); Keyboard.releaseShift(); break; } case COOKING: } return 0; } private enum State { BANKING, DROPPING, COOKING } private State getState() { if (Inventory.count(shark) == 28) { state = State.BANKING; log("Banking"); } else if (Inventory.count(uShark) > 1) { state = State.DROPPING; log("Dropping"); }if (Inventory.count(uShark) == 1) { state = state.COOKING; log("cooking"); } return state; } public void onStart(){ log("Bot has started"); } public void onExit(){ } } only drops 1 shark, pls help Link to comment Share on other sites More sharing options...
CodeNinja 32 Share Posted January 8, 2021 the Inventory.drop method uses shift dropping FYI anyway: you have the timeout set to 1000, so it stops holding shift after 1 second Link to comment Share on other sites More sharing options...
TheCloakdOne 389 Share Posted January 8, 2021 Keyboard.pressShift(); // Drop logic here (your for loop) Keyboard.releaseShift(); Link to comment Share on other sites More sharing options...
smh1 0 Author Share Posted January 8, 2021 Thanks for the help! Cloaked solution helped me and it's working now! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.