Imthabawse Posted March 24, 2019 Share Posted March 24, 2019 (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 March 24, 2019 by Imthabawse Quote Link to comment Share on other sites More sharing options...
FuryShark Posted March 24, 2019 Share Posted March 24, 2019 Dont the coords change each time you enter your poh? 1 Quote Link to comment Share on other sites More sharing options...
Imthabawse Posted March 24, 2019 Author Share Posted March 24, 2019 @FuryShark Don't believe so can test this though. Quote Link to comment Share on other sites More sharing options...
Naked Posted March 24, 2019 Share Posted March 24, 2019 Try cleaning it up some. Makes debugging/improving 100x easier. Quote Link to comment Share on other sites More sharing options...
Imthabawse Posted March 24, 2019 Author Share Posted March 24, 2019 @FuryShark Yup seems to be the case. Thanks for pointing that out. Back to the drawling boards lol. Quote Link to comment Share on other sites More sharing options...
Imthabawse Posted March 24, 2019 Author Share Posted March 24, 2019 (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 March 24, 2019 by Imthabawse Quote Link to comment Share on other sites More sharing options...
kristapsss Posted March 24, 2019 Share Posted March 24, 2019 demon change location's all the time. Quote Link to comment Share on other sites More sharing options...
Imthabawse Posted March 24, 2019 Author Share Posted March 24, 2019 6 hours ago, kristapsss said: demon change location's all the time. I have a single dungeon room which is small enough that .closest works just fine. Ran it for bout an hour straight no issues. Quote Link to comment Share on other sites More sharing options...