Jump to content

Oak Doors ;)


Recommended Posts

Posted (edited)

Hello again and welcome back to Oak Doors V2 this time around I've implemented only ConditionalSleeps seems to run pretty smooth.

To start it you need:

- Saw/Crystal Saw

- Hammer

- Nails

- Demon butler (Servant)

- Have his task set to withdraw (20) oak planks from bank

- Start script in player owned dungeon (Single room)

- Call Servant at least once before starting script

- Money bag with money in it (preferably 500k+ for longer runs)

- Have Build mode ON

Once all these have been met start script and sit back and enjoy the levels :)

Thing's to improve

- Interact with Butler before completely out of Oak planks so constantly building/removing and having butler fetch planks (Faster EXP rates)

I know about the && operator as well so don't hate just how I like to write for time being. ?

All feedback both Negative && Positive are welcome. Code below. ?

 

import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.api.ui.RS2Widget;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;


@ScriptManifest(name = "Perfect Doors", logo = "", version = 1, author = "Imthabawse", info = "Makes Oak doors, calls for butler to get planks from bank.")



public class PerfectDoors extends Script {


    // To start script: 1. Building mode ON 2. Oak planks in bank 3. Have Hammer, Saw, Nails in inventory

// oak door area

// butler area

    // build/remove code
    private void build() {

        if (getInventory().getAmount("Oak plank") >= 10) {
            if (!myPlayer().isAnimating()) {
                if (!myPlayer().isMoving()) {
                    RS2Object doorSpace = getObjects().closest("Door space");
                    log("Getting Door space..");
                    if (doorSpace != null) {
                        RS2Object builtdoor = getObjects().closest("Door");
                        if(builtdoor == null) {
                            doorSpace.interact("Build");
                            log("Interacting with Door space.");
                            new ConditionalSleep(2000) {
                                @Override
                                public boolean condition() {
                                    return getWidgets().getWidgetContainingText("Furniture Creation Menu") != null;
                                }
                            }.sleep();
                            RS2Widget oakDoor = getWidgets().get(458, 4, 4);
                            if (oakDoor != null) {
                                oakDoor.interact();
                                log("Building..");
                                new ConditionalSleep(2000) {
                                    @Override
                                    public boolean condition() {
                                        return myPlayer().isAnimating();
                                    }
                                }.sleep();
                            }
                        }
                    }
                }
            }
        }
    }

    private void remove() {
        RS2Object door = getObjects().closest("Door");
        log("Getting Door");
        if (door != null) {
            if (!myPlayer().isAnimating()) {
                door.interact("Remove");
                log("Interacting with Door.");
                new ConditionalSleep(2000) {
                    @Override
                    public boolean condition() {
                        return getWidgets().getWidgetContainingText("Really remove it?") != null;
                    }
                }.sleep();
                RS2Widget yes = getWidgets().getWidgetContainingText("Yes");
                if (yes != null) {
                    if (!myPlayer().isAnimating()) {
                        yes.interact();
                        log("Removing Door..");
                        new ConditionalSleep(2000) {
                            @Override
                            public boolean condition() {
                                return myPlayer().isAnimating();
                            }
                        }.sleep();
                    }
                }
            }
        }
    }
    // butler code
    private void butler() throws InterruptedException {
        if (getInventory().getAmount("Oak plank") < 10) {
            if (!myPlayer().isAnimating()) {
                NPC demonbutler = getNpcs().closest("Demon butler");
                log("Getting butler..");
                if (demonbutler != null) {
                    demonbutler.interact("Talk-to");
                    log("Interacting with butler.");
                    new ConditionalSleep(2000) {
                        @Override
                        public boolean condition() {
                            return getWidgets().getWidgetContainingText("Repeat last task?") != null;
                        }
                    }.sleep();
                    RS2Widget fetch = getWidgets().getWidgetContainingText("Fetch from bank: 20 x Oak plank");
                    if (fetch != null) {
                        fetch.interact();
                        log("Waiting on planks to build..");
                        sleep(random(300, 600));
                        getMouse().moveOutsideScreen();
                        new ConditionalSleep(7200) {
                            @Override
                            public boolean condition() {
                                return getInventory().getAmount("Oak plank") >= 10;
                            }
                        }.sleep();
                    }
                }
            }
        }
    }




    @Override
    public int onLoop() throws InterruptedException {
        if(myPlayer().getAnimation() < 1) {
            build();
            remove();
            butler();
        }

        return 1500;
    }
}

 

Edited by Imthabawse
Posted (edited)

Might have fixed..Got rid of area and added:

RS2Object builtdoor = getObjects().closest("Door");
                        if(builtdoor == null) {
                            doorSpace.interact("Build");

into the Build() method. Seems to be working so far as always can use tweaks here and there.

Will edit code in original post to working version.

Edited by Imthabawse

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...