Lol_marcus Posted June 8, 2020 Share Posted June 8, 2020 Once it finishes the dialog with the wizard, it loops back to the bank and tries to get beads again. What am I doing wrong here? I've tried different variations and can't get it to stop once it sees the "Congratulations" message! package quests; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.model.*; import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.utility.ConditionalSleep; public class ImpCatcher extends QuestObject { private Area wizardsTower; private Area[] area = { new Area(3103, 3162, 3105, 3164).setPlane(2), // wizards tower }; private String[] items = new String[] { "Red bead", "Black bead", "Yellow bead", "White bead" }; public ImpCatcher() { wizardsTower = area[0]; } @Override public int run() throws InterruptedException { if (!checkInventory()) { return 1; } switch (configs.get(808)) { case 0: startQuest(); break; case 1: if (completeQuest()) { log("Quest Complete!"); return 2; } case 2: log("Quest has already been completed!"); default: return 2; } return 1; } private boolean checkInventory() throws InterruptedException { boolean inventoryReady = getInventory().contains(items); if (!inventoryReady && !Banks.DRAYNOR.contains(myPosition())) { getWalking().webWalk(Banks.DRAYNOR); return false; } else if (!inventoryReady && Banks.DRAYNOR.contains(myPosition())) { openBank(); bankItems(); takeBankItems(); return true; } else { log("Inventory does not need to be banked!"); return true; } } private void openBank() throws InterruptedException { if (!getBank().isOpen()) { getBank().open(); log("Opening Bank..."); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return getBank().isOpen(); } }.sleep(); } else { log("Bank is already open!"); } } private void takeBankItems() { for (String item : items) { if (getBank().contains(item)) { log("Found item for quest: " + item); getBank().withdraw(item, 1); } } } private void bankItems() { if (getBank().depositAll()) { log("Deposited all items!"); } else { log("There was an issue depositing all items!"); } } private void walkToArea(Area area, String location) { log("Walking to: " + location); if (!area.contains(myPosition())) { getWalking().webWalk(area); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return area.contains(myPosition()); } }.sleep(); } else { log("Already in Area: " + location); } } private void startQuest() throws InterruptedException { RS2Widget widget = getWidgets().get(277, 1); // walk to the tower walkToArea(wizardsTower, "Wizard's tower"); talkToWizard(); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return widget != null && widget.isVisible(); } }.sleep(); } public boolean completeQuest() { RS2Widget widget = getWidgets().get(277, 1); return (widget != null && widget.isVisible()); } private void talkToWizard() throws InterruptedException { Entity wizard = npcs.closest("Wizard Mizgog"); if (wizard != null) { if (!getDialogues().inDialogue()) { log("Not talking to Mizgog. Starting conversation."); wizard.interact("Talk-to"); log("Sleeping until conversation starts!"); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return getDialogues().inDialogue(); } }.sleep(); } String[] options = new String[] { "Click here to continue", "Give me a quest please." }; if (getDialogues().completeDialogue(options)) { log("Dialogue complete successfully!"); } else { log("Dialogue failed!"); } log("Just spoke with Mizgog!"); } } } Quote Link to comment Share on other sites More sharing options...
BravoTaco Posted June 9, 2020 Share Posted June 9, 2020 (edited) What are you doing with the returned int value in the run()? Also are you sure that 2 is the correct child id of 808 when the quest is complete? Edited June 9, 2020 by BravoTaco 1 Quote Link to comment Share on other sites More sharing options...
Lol_marcus Posted June 9, 2020 Author Share Posted June 9, 2020 7 hours ago, BravoTaco said: What are you doing with the returned int value in the run()? Also are you sure that 2 is the correct child id of 808 when the quest is complete? Oops. The ID was 3, not 2. Thanks. ^^ Quote Link to comment Share on other sites More sharing options...