Samuel91 6 Posted November 25, 2019 I'm trying to add a delay to the LoginSolver, but so far am having no luck. The below code should: Detect that im logged out Wait 10 seconds Log in Once logged in disable LoginSolver (it never gets to this part) Continue with the script (in this case outputting hello world!) but it just keeps trying to run the login code over and over again public class Main extends AbstractScript { public void onStart() { getRandomManager().disableSolver(RandomEvent.LOGIN); } @Override public int onLoop() { if (!GameState.valueOf("LOGGED_IN").equals(true)) { log("got here 1 !!!!"); //int sleepamount = Calculations.random(30, 181); // 30 seconds - 180 seconds (3 minutes) int sleepamount = 10; log("Will log in in: " + sleepamount + " seconds"); sleep(sleepamount * 1000); log("starting login"); getRandomManager().enableSolver("LOGIN"); } else if (GameState.valueOf("LOGGED_IN").equals(true)) { log("got here 2 !!!"); getRandomManager().disableSolver("LOGIN"); } log("Hello, world!"); return 3000; } }
Samuel91 6 Author Posted November 25, 2019 I think that did it. Pseudo's suggestion did the trick. public class Main extends AbstractScript { public void onStart() { getRandomManager().disableSolver(RandomEvent.LOGIN); } @Override public int onLoop() { if (getClient().getGameState() != GameState.LOGGED_IN) { //int sleepamount = Calculations.random(30, 181); // 30 seconds - 180 seconds (3 minutes) int sleepamount = 10; log("Will log in in: " + sleepamount + " seconds"); sleep(sleepamount * 1000); log("starting login"); getRandomManager().enableSolver("LOGIN"); getRandomManager().onLoop(); return 0; } getRandomManager().disableSolver("LOGIN"); log("Hello, world!"); return 3000; } }
Pseudo 179 Posted November 25, 2019 19 minutes ago, Samuel91 said: I think that did it. Pseudo's suggestion did the trick. public class Main extends AbstractScript { public void onStart() { getRandomManager().disableSolver(RandomEvent.LOGIN); } @Override public int onLoop() { if (getClient().getGameState() != GameState.LOGGED_IN) { //int sleepamount = Calculations.random(30, 181); // 30 seconds - 180 seconds (3 minutes) int sleepamount = 10; log("Will log in in: " + sleepamount + " seconds"); sleep(sleepamount * 1000); log("starting login"); getRandomManager().enableSolver("LOGIN"); getRandomManager().onLoop(); return 0; } getRandomManager().disableSolver("LOGIN"); log("Hello, world!"); return 3000; } } Glad to hear pal. It was more of a guess than anything, lol. Never actually tampered with the login random myself, but I had a vague recollection of using that method to check when/if I happened to be logged in.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.