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
  • new to dreambot language need help asap!


    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.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;
    
    @ScriptManifest(
            author = "smh1",
            description = "Cooker",
            category = Category.COOKING,
            version = 0.01,
            name = "Speed Cooker"
    )
    
    public class Main extends AbstractScript {
    
        Area cookingSpot = new Area(3043, 4972, 1,0);
    
        public int uShark = 383;
        public int shark = 385;
        public int banker = 3194;
        public int fire = 26185;
        GroundItem uncookedShark = GroundItems.closest(uShark);
    
    
        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.withdraw(uShark, 28);
                        sleepUntil(() -> Inventory.isFull(), Calculations.random(50, 120));
                        Bank.close();
                    } else if (Inventory.containsAll(shark)) {
                        Bank.depositAllItems();
                        sleepUntil(() -> Inventory.isEmpty(), 100, 250);
                        Bank.withdrawAll(uShark);
                        sleepUntil(() -> Inventory.containsAll(uShark), Calculations.random(50, 200));
                        Bank.close();
                    }
                    break;
    
                case DROPPING:
                        Inventory.drop(uShark);
                    break;
    
                case COOKING:
    
                        Inventory.get(uShark).interact("Use");
                        sleepUntil(() -> Inventory.isItemSelected(), Calculations.random(10, 70));
                        GameObject firee = GameObjects.closest(fire);
                        firee.interact("Use");
                        GroundItem uncookedShark = GroundItems.closest(uShark);
                        if (uncookedShark != null)
                            uncookedShark.interact("Take");
                    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) && !Bank.isOpen()){
                state = State.DROPPING;
                log("Dropping");
            }else if (uncookedShark.equals(27) && Inventory.contains(uShark==1));
                state = State.COOKING;
                log("Cooking");
            return state;
        }
    
        public void onStart(){
            log("Bot has started");
        }
    
        public void onExit(){
    
        }
    }
    

     

    image.png.f43be3201fdbdbdb8bf919b03f9a4d80.png

    This is when I try running it with full inv of sharks. He just spam clicks on shark and then the fire.

    image.png.b0889178103455218e404d4ec4246590.png

    this happens when I try running it with no sharks in my inv.

    Link to comment
    Share on other sites

    I'm really lost tbh.. I need you to elaborate more, because I'm really new to scripting.. And I need your help, man!

    Link to comment
    Share on other sites

    24 minutes ago, smh1 said:

    I'm really lost tbh.. I need you to elaborate more, because I'm really new to scripting.. And I need your help, man!

    It sounds to me like you don't have much actual Java programming experience.  I would suggest going onto YouTube and finding an introduction to Java video.  Should be a couple hours long and it will help you a lot more than waiting for answers on the forum post.

    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.