Russian_Savage Posted August 3, 2015 Share Posted August 3, 2015 What is the best way to talk to NPC's if there are a few click to continue buttons and a few multiple choices... I have so far used widgets for this, but my script sometimes stops randomly. I want this to be flawless. Quote Link to comment Share on other sites More sharing options...
iJodix Posted August 3, 2015 Share Posted August 3, 2015 Dialogue API; http://osbot.org/api/org/osbot/rs07/api/Dialogues.html 1 Quote Link to comment Share on other sites More sharing options...
Russian_Savage Posted August 3, 2015 Author Share Posted August 3, 2015 Dialogue API; http://osbot.org/api/org/osbot/rs07/api/Dialogues.html Yea i don't know how to use those. Quote Link to comment Share on other sites More sharing options...
Flamezzz Posted August 3, 2015 Share Posted August 3, 2015 (edited) if(dialogues.isPendingContinuation() || dialogues.clickContinue() || dialogues.completeDialogue("option1", "option2", "option3")) return random(300,600); Edited August 3, 2015 by Flamezzz Quote Link to comment Share on other sites More sharing options...
Russian_Savage Posted August 3, 2015 Author Share Posted August 3, 2015 (edited) if(dialogues.isPendingContinuation() || dialogues.clickContinue() || dialogues.completeDialogue("option1", "option2", "option3")) return random(300,600); I am sorry for being a complete noob, but how would I use that. I tried entering it like this. if(npc != null) if(npc.isOnScreen()){ npc.interact("Talk-to"); if(dialogues.isPendingContinuation() || dialogues.clickContinue() || dialogues.completeDialogue("option 1")) return random(300,600); }else{ if (!npc.isOnScreen()); localWalker.walk(npc); } But it's not working. Edited August 3, 2015 by Russian_Savage Quote Link to comment Share on other sites More sharing options...
iJodix Posted August 3, 2015 Share Posted August 3, 2015 if (!dialogues.inDialogue()) { if (npc != null) { if (npc.isVisible()) { if (npc.interact("Talk-to")) { new ConditionalSleep(random(1000, 2000)) { public boolean condition() throws InterruptedException { return dialogues.inDialogue(); } }.sleep(); } } else { getCamera().toEntity(npc); } } } else { if (dialogues.isPendingOption()) { dialogues.completeDialogue("plebs4free", "plebs4free", "plebs4free","plebs4free"); sleep(random(400, 900)); } if (dialogues.isPendingContinuation()) { dialogues.clickContinue(); sleep(random(400, 900)); } } Quote Link to comment Share on other sites More sharing options...
Russian_Savage Posted August 3, 2015 Author Share Posted August 3, 2015 (edited) if (!dialogues.inDialogue()) { if (npc != null) { if (npc.isVisible()) { if (npc.interact("Talk-to")) { new ConditionalSleep(random(1000, 2000)) { public boolean condition() throws InterruptedException { return dialogues.inDialogue(); } }.sleep(); } } else { getCamera().toEntity(npc); } } } else { if (dialogues.isPendingOption()) { dialogues.completeDialogue("plebs4free", "plebs4free", "plebs4free","plebs4free"); sleep(random(400, 900)); } if (dialogues.isPendingContinuation()) { dialogues.clickContinue(); sleep(random(400, 900)); } } Thank you for the help really appreciate it. I hate being spoon fed so could you tell me why my code didn't work. Was it because i didnt check if i was in dialogue in the beginning? minus the shit code of course. XD Edited August 3, 2015 by Russian_Savage Quote Link to comment Share on other sites More sharing options...
iJodix Posted August 3, 2015 Share Posted August 3, 2015 The code @Flamezzz posted is .. so wrong .. Quote Link to comment Share on other sites More sharing options...
Russian_Savage Posted August 3, 2015 Author Share Posted August 3, 2015 The code @Flamezzz posted is .. so wrong .. hahaha ah ok. Gotchya. Reading your code made perfect sense after the first read. Thank you for your help I really appreciate it. Quote Link to comment Share on other sites More sharing options...
Flamezzz Posted August 3, 2015 Share Posted August 3, 2015 The code @Flamezzz posted is .. so wrong .. It's not used correctly, it's supposed to be the first thing in the onLoop so that in the next lines you know you're not in a dialogue. Anyways I'm glad it's solved now. Quote Link to comment Share on other sites More sharing options...
Bobrocket Posted August 3, 2015 Share Posted August 3, 2015 Another handy thing to do is you can now simply press SPACE on your keyboard to continue, and the numbers 1 through x for the options. Press space: getKeyboard().typeKey((char)32); Character code 32 equates to SPACE (" ") A list of character codes: (Look at the DEC values) If you want to press enter, you need to press 2 keys in rapid succession, which are keys 13 and 10: getKeyboard().typeKey((char)13); getKeyboard().typeKey((char)10); 1 Quote Link to comment Share on other sites More sharing options...