bthebrave Posted April 17, 2015 Share Posted April 17, 2015 (edited) I'm trying to make a simple blast furnace script for myself and friends to use, i.e. no paint & bare bones code. When it talks to the foreman, I just hard-coded a simple 3-second sleep after every command. Is there a method in the API that can tell when the next dialogue has not yet appeared and it's still waiting for the next one? My current code is like so: dialogues.clickContinue(); sleep(3000); dialogues.selectOption("What?"); sleep(3000); dialogues.clickContinue(); sleep(3000); dialogues.clickContinue(); sleep(3000); dialogues.selectOption("Can I use the furnace to smelt ore?"); sleep(3000); I would prefer it to be like this: dialogues.clickContinue(); while(/*is waiting for the next prompt*/){ sleep(250); } dialogues.selectOption("What?"); while(/*is waiting for the next prompt*/){ sleep(250); } dialogues.clickContinue(); while(/*is waiting for the next prompt*/){ sleep(250); } dialogues.clickContinue(); while(/*is waiting for the next prompt*/){ sleep(250); } dialogues.selectOption("Can I use the furnace to smelt ore?"); while(/*is waiting for the next prompt*/){ sleep(250); } Thanks, BTheBrave Edited April 17, 2015 by bthebrave Quote Link to comment Share on other sites More sharing options...
Woody Posted April 18, 2015 Share Posted April 18, 2015 (edited) I wouldn't do this. This will be really buggy and hardly work. Use if-else method and get the ids for every widget; by that you can check if a widget is null or not. For instance: if(widget1 != null) { do action for(int i = 0; i < 100 && widget1 != null; i++) { sleep(random(4, 8)); // will sleep random 400-800 ms since 4*100=400 and 8*100=800, or till widget1 == null } } else { talk to foreman and wait for widget1 using dynamic sleep like a for-loop } and so on Edited April 18, 2015 by Woody 1 Quote Link to comment Share on other sites More sharing options...