Normangorman Posted July 10, 2015 Share Posted July 10, 2015 Does anyone know how to implement this? Scripts seem to get a couple of 'onLoop's off in between the client solving the login screen event and detecting the welcome screen event. The welcome screen seems to cause weird bugs in the initial part of a script if you need to set up config based on what the player can see. Quote Link to comment Share on other sites More sharing options...
Flamezzz Posted July 10, 2015 Share Posted July 10, 2015 You could sleep when bot.getRandomExecutor().forEvent(RandomEvent.WELCOME_SOLVER).shouldActivate() == true, assuming the widget is actually visible when this happens. Quote Link to comment Share on other sites More sharing options...
Bobrocket Posted July 10, 2015 Share Posted July 10, 2015 (edited) if (!getClient().isLoggedIn()) { //Conditional sleep until getClient().isLoggedIn() } Edit: Just wanna add that a conditional sleep may not be the best for this, eg if it's in onloop you can just do: if (!getClient().isLoggedIn()) { return 1000; } Edited July 10, 2015 by Bobrocket Quote Link to comment Share on other sites More sharing options...
Normangorman Posted July 12, 2015 Author Share Posted July 12, 2015 if (!getClient().isLoggedIn()) { //Conditional sleep until getClient().isLoggedIn() } Edit: Just wanna add that a conditional sleep may not be the best for this, eg if it's in onloop you can just do: if (!getClient().isLoggedIn()) { return 1000; } You could sleep when bot.getRandomExecutor().forEvent(RandomEvent.WELCOME_SOLVER).shouldActivate() == true, assuming the widget is actually visible when this happens. Thanks for your help. By combining both of these checks I was able to create a snippet that solves the problem. Note that RandomSolver#shouldActivate crashes with a NullPointerException if you call it for the WELCOME_SOLVER event when you're already logged in. This is probably a bug - and is the reason for the try - catch below. if (!doneOnReady) { boolean loggedIn = bot.getClient().isLoggedIn(); boolean inWelcomeScreen; try { inWelcomeScreen = bot.getRandomExecutor().forEvent(RandomEvent.WELCOME_SOLVER).shouldActivate(); } catch (NullPointerException e) { inWelcomeScreen = false; } if (loggedIn && inWelcomeScreen == false) { onReady(); doneOnReady = true; } else { return 100; } } 1 Quote Link to comment Share on other sites More sharing options...