Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • dropping my whole inventory, while I need to keep 1 item.


    smh1
     Share

    Recommended Posts

     

    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.dialogues.Dialogues;
    import org.dreambot.api.methods.interactive.GameObjects;
    import org.dreambot.api.methods.interactive.NPCs;
    import org.dreambot.api.methods.item.GroundItems;
    import org.dreambot.api.methods.map.Area;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.wrappers.interactive.GameObject;
    import org.dreambot.api.wrappers.interactive.NPC;
    import org.dreambot.api.wrappers.items.GroundItem;
    import org.dreambot.api.wrappers.items.Item;
    
    import java.awt.*;
    
    @ScriptManifest(
            author = "smh1",
            description = "Cooker",
            category = Category.COOKING,
            version = 0.01,
            name = "Speed Cooker"
    )
    
    public class Main extends AbstractScript {
    
        int dropOrder[] = {1,2,3,7,6,5,4,8,9,10,11,15,14,13,12,16,17,18,19,23,22,21,20,24,25,26,27};
    
        public int uShark = 383;
        public int shark = 385;
        public int banker = 3194;
        public int fire = 26185;
    
        GroundItem uncookedShark = GroundItems.closest(383);
    
    
        State state;
    
        @Override
        public int onLoop() {
    
            switch (getState()) {
                case BANKING:
                    NPC bankMan = NPCs.closest(banker);
                    bankMan.interact("Bank");
                    sleepUntil(() -> Bank.isOpen(), Calculations.random(1000, 2000));
                    if (Bank.isOpen() && Inventory.isEmpty() || Bank.isOpen() && Inventory.containsAll(shark)) {
                        Bank.depositAllItems();
                        sleepUntil(() -> Inventory.isEmpty(), 100, 250);
                        Bank.withdraw(uShark, 28);
                        sleepUntil(() -> Inventory.isFull(), Calculations.random(50, 120));
                        Bank.close();
                        sleep(1000);
                    }
                    break;
    
                case DROPPING:
    
                    Inventory.dropAll();
                    break;
    
                case COOKING:
                    Inventory.get(uShark).interact("Use");
                    sleepUntil(() -> Inventory.isItemSelected(), Calculations.random(10, 70));
                    GameObject firee = GameObjects.closest(fire);
                    firee.interact("Use");
                    break;
    
            }
            return 0;
        }
    
        private enum State{
            BANKING,DROPPING,COOKING
        }
    
        private State getState() {
            if (Inventory.isEmpty() || Inventory.containsAll(shark)) {
                state = State.BANKING;
                log("Banking");
            } else if (Inventory.containsAll(uShark)){
                state = State.DROPPING;
                log("Dropping");
            } else if (Inventory.contains(uShark == 1)){
            state = State.COOKING;
            log("Cooking");
        }
            return state;
        }
    
        public void onStart(){
            log("Bot has started");
        }
    
        public void onExit(){
    
        }
    }

    why isn't the bot switching to cooking state, I indicate that when he has only 1 shark left he must cook it. 

    Link to comment
    Share on other sites

    lol.......................

    evaluate what this means

    uShark == 1

    turns into 383==1; think about it if it was an if statement if(ushark ==1) what would happen?

    u basicly wrote 

    Inventory.contains(uShark == 1)

    is

    Inventory.contains(false)


     

    Edited by dream21
    inventory.contains(false)
    Link to comment
    Share on other sites

    Thanks, Dream21, for explaining my mistake. I found it really helpful, but can anyone help me out real quick?

     

    Link to comment
    Share on other sites

    6 minutes ago, smh1 said:

    Thanks, Dream21, for explaining my mistake. I found it really helpful, but can anyone help me out real quick?

     

    imagine getting spoonfed the answer and then being like "but can anyone help me out real quick?" L0l

    Link to comment
    Share on other sites

    I've also tried this 

    else if (Inventory.count(uShark) == 1)
    

    but it still doesn't work?.. Can anyone help me out? I'm stuck..

    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.