April 25, 201510 yr Hello fellas it's me again,I'm trying to get my script past a series of dialogues, where there is a continue option or 2 options to choose the script manages to click my chosen option. When the script is at the dialogue which contains 3 options, it somehow fails to choose the option i want it to choose.Does anybody know why this is / how to fix this?My code : case WALK_BANK_D1: if(dialogues.isPendingContinuation()) { dialogues.clickContinue(); sleep(random(200, 600)); } else if(dialogues.isPendingOption()) { dialogues.selectOption("Can I journey on this ship?"); sleep(random(200, 600)); } else if(dialogues.isPendingOption()) { dialogues.selectOption("Search away, I have nothing to hide."); sleep(random(200, 600)); } else if(dialogues.isPendingOption()) { dialogues.selectOption("Ok."); sleep(random(200, 600)); This is where the problem occurs : } else if(dialogues.isPendingOption()) { dialogues.selectOption("Search away, I have nothing to hide."); sleep(random(200, 600));
April 25, 201510 yr I feel you don't fully understand else statements. String[] options = new String[]{"Can I journey on this ship?", "Search away, I have nothing to hide.", "Ok." }; if(dialogues.isPendingContinuation()){ dialogues.clickContinue(); }else if (dialogues.isPendingOption()){ if(dialogues.selectOption(options)){ sleep(random(200, 600)); } } Edited April 25, 201510 yr by Isolate
April 25, 201510 yr Author I feel you don't fully understand else statements. String[] options = new String[]{"Can I journey on this ship?", "Search away, I have nothing to hide.", "Ok." }; if(dialogues.isPendingContinuation()){ dialogues.clickContinue(); }else if (dialogues.isPendingOption()){ if(dialogues.selectOption(options)){ sleep(random(200, 600)); } } Yes, you are right i'm still looking into all of it. Could you rewrite this code for me with the method you just did? http://pastebin.com/SEMnP0FX
April 25, 201510 yr Yes, you are right i'm still looking into all of it. Could you rewrite this code for me with the method you just did? http://pastebin.com/SEMnP0FX private final String[] SEAMAN_OPTIONS = new String[]{"Can I journey on this ship?", "Search away, I have nothing to hide." }; void handleSeaman() throws InterruptedException { if(dialogues.inDialogue()){ if(dialogues.isPendingContinuation()){ if(dialogues.clickContinue()){ sleep(random(200, 600)); } }else if(dialogues.isPendingOption()){ if(dialogues.selectOption(SEAMAN_OPTIONS)){ sleep(random(200, 600)); } } }else{ NPC seaman = npcs.closest(new Filter<NPC>() { @Override public boolean match(NPC npc) { return npc != null && npc.getName().contains("Seaman"); } }); if(seaman != null){ if(seaman.isVisible()){ if(seaman.interact("Pay-fare")){ sleep(random(750, 900)); } }else{ camera.toEntity(seaman); } } } } } Even though i'm pretty sure that's the dialog for the customs officer...
April 25, 201510 yr Author private final String[] SEAMAN_OPTIONS = new String[]{"Can I journey on this ship?", "Search away, I have nothing to hide." }; void handleSeaman() throws InterruptedException { if(dialogues.inDialogue()){ if(dialogues.isPendingContinuation()){ if(dialogues.clickContinue()){ sleep(random(200, 600)); } }else if(dialogues.isPendingOption()){ if(dialogues.selectOption(SEAMAN_OPTIONS)){ sleep(random(200, 600)); } } }else{ NPC seaman = npcs.closest(new Filter<NPC>() { @Override public boolean match(NPC npc) { return npc != null && npc.getName().contains("Seaman"); } }); if(seaman != null){ if(seaman.isVisible()){ if(seaman.interact("Pay-fare")){ sleep(random(750, 900)); } }else{ camera.toEntity(seaman); } } } } } Even though i'm pretty sure that's the dialog for the customs officer... Using that doesn't work for me. But the other series of dialogues runs fine for me, same method : case WALK_BACK_D1: if(dialogues.isPendingContinuation()) { dialogues.clickContinue(); sleep(random(200, 700)); } else if(dialogues.isPendingOption()) { dialogues.selectOption("Yes please."); sleep(random(200, 700)); } else { Entity sailor = npcs.closest("Seaman Thresnor", "Seaman Lorris", "Captain Tobias"); if (sailor!= null) { sailor.interact("Pay-fare"); } else { log("Sailor is null"); } } sleep(random(200, 600)); break;
Create an account or sign in to comment