Jump to content

Oak Doors ;)


Imthabawse

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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