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


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

    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.