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
  • script i copied not working in intellij


    iannat

    Recommended Posts

    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.container.impl.equipment.EquipmentSlot;
    import org.dreambot.api.methods.tabs.Tab;
    import org.dreambot.api.script.AbstractScript;
    
    public class CrystalChest extends Node {
    
        public CrystalChest(AbstractScript as) {
            super(as);
        }
    
        @Override
        public boolean activate() throws InterruptedException {
            return Values.CRYSTAL_CHEST.contains(as.getLocalPlayer().getTile());
        }
    
        @Override
        public void execute() throws InterruptedException {
            as.log("At crystal chest.");
            if (as.getCamera().getYaw() < 1500 || as.getCamera().getYaw() > 1800) {
                as.getCamera().rotateToYaw(Calculations.random(1500, 1800));
            }
    
            // if we have rings at the chest, open them
            if (as.getInventory().contains(Values.CRYSTAL_KEY) && !as.getInventory().isFull()) {
                as.log("opening chest");
                //interact with chest
                if (as.getInventory().isItemSelected()) {
                    as.getInventory().deselect();
                }
                as.sleep(500);
                as.getInventory().get(Values.CRYSTAL_KEY).useOn(as.getGameObjects().closest("Closed chest"));
                as.sleep(Calculations.random(1000, 1500));
            } else {
                //teleport to castle wars
                as.getTabs().openWithMouse(Tab.EQUIPMENT);
                as.getEquipment().interact(EquipmentSlot.RING, "Castle Wars");
                as.sleepUntil(() -> Values.CASTLE_WARS.contains(as.getLocalPlayer().getTile()), 3000);
            }
        }
    }

     

     

    can somone tell me whats wrong?

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