DirtyDick Posted April 18, 2022 Share Posted April 18, 2022 Just started on a Romeo and Juliet script and I was wondering if there was a more efficient way to write a dialogue handler? When interacting with NPCs, I'm adding each specific dialogue option manually when required and then calling another Method to get through the regular ("Click to continue") dialogue. This is how my script looks so far: @Override public int onLoop() throws InterruptedException { Position julietHouse = new Position(3159, 3425, 1); WebWalkEvent walkToJuliet = new WebWalkEvent(julietHouse); walkToJuliet.setMinDistanceThreshold(1); Area romeo = new Area (3209, 3422, 3215, 3425); if (!romeo.contains(myPlayer())) { log("Walking to Romeo"); getWalking().webWalk(romeo.getRandomPosition()); } log("Starting quest..."); npcs.closest("Romeo").interact("Talk-to"); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return getDialogues().inDialogue(); } }.sleep(); randSleep(); getThroughDialogue(); getDialogues().selectOption(1); randSleep(); getThroughDialogue(); getDialogues().selectOption(1); randSleep(); My getThroughDialogue method: public void getThroughDialogue() throws InterruptedException { for (getDialogues().isPendingContinuation(); getDialogues().clickContinue() ; randSleep()); } Is there a better/cleaner way to navigate dialogue while implementing sleeps? I'm really enjoying writing this quest script and I figured I should learn now as I'm planning to make several more. I saw in the API there is a completeDialogue method but I wasn't confident on how to use it, and wanted to add my own random interval sleeps during the dialogue to simulate a player reading the text. Note: my getThroughDialogue method works fine when I run it but it's my first time using a for loop so it may be incorrect Quote Link to comment Share on other sites More sharing options...
popshopadop Posted April 18, 2022 Share Posted April 18, 2022 I recommend going to the api, and googling that api with"site:osbot.org" attached at the end. there is an api that if you have an array of dialogues you want the bot to read through, it will. issues with this is if you have more complex dialogues to go through that each question has to be answered which iirc, RandJ does not have. i dont have the code on hand for what you want but the api will be something of: getDialogues().completeDialogues(String ... ArrayOfDiags) 1 Quote Link to comment Share on other sites More sharing options...
DirtyDick Posted April 18, 2022 Author Share Posted April 18, 2022 2 hours ago, popshopadop said: I recommend going to the api, and googling that api with"site:osbot.org" attached at the end. there is an api that if you have an array of dialogues you want the bot to read through, it will. issues with this is if you have more complex dialogues to go through that each question has to be answered which iirc, RandJ does not have. i dont have the code on hand for what you want but the api will be something of: getDialogues().completeDialogues(String ... ArrayOfDiags) Great tip thank you, I'll look into this and search the api + site:osbot.org in future Quote Link to comment Share on other sites More sharing options...