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
  • dropping my whole inventory, while I need to keep 1 item.


    smh1

    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)


     

    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

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • 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.