ThatGamerBlue Posted September 4, 2017 Share Posted September 4, 2017 When you level up you stop skilling, how can I detect this and restart? Right now I'm using message detection using onMessage but It doesn't seem to work. boolean doBreak = false; @Override public void onMessage(Message m){ if(m.getType() == MessageType.GAME && m.getMessage().contains("You are now level") && !doBreak){ doBreak = true; } } @Override public int onLoop() throws InterruptedException { // code to start making pizza while(getInventory().contains("Anchovies") && getInventory().contains("Plain pizza")){ sleep(random(250, 500)); if(doBreak){ doBreak = false; sleep(random(100, 200)); break; } } } Full code: https://hastebin.com/defifurane.java Quote Link to comment Share on other sites More sharing options...
IHB Posted September 4, 2017 Share Posted September 4, 2017 mm if that void works then u could just try using the getskills.getstatic.cooking? and store the previous level as an int somewhere, thats what i did for switching weapons whilst leveling up atk 1 Quote Link to comment Share on other sites More sharing options...
Deceiver Posted September 4, 2017 Share Posted September 4, 2017 private void handleDialogue() { if (getDialogues().isPendingContinuation()) { getDialogues().clickContinue(); log("Handling dialogue"); Sleep.sleepUntil(() -> !getDialogues().isPendingContinuation(), 5000); } } Sleep class is from explvs conditional sleep snippet Quote Link to comment Share on other sites More sharing options...
Apaec Posted September 4, 2017 Share Posted September 4, 2017 You will need a more advanced solution for this rather than just checking for the level up message, to account for other interruptions and to more reliably accommodate for level ups. I'm not sure how you're tracking when you finish the inventory (hopefully not a massive 40 second long sleep!), but I would suggest moving over to a timer-based system (I have this implemented in my AIO Cooker). The idea is that a timer is running in the background and is reset when you're animating (or some other check to determine whether you're cooking). If this timer exceeds a threshold, then you're probably no longer cooking and the interaction code kicks in. For this timer to work however, you will need some kind of async thread to work in. You could use the onPaint, however onPaint should really not be used for anything more than paint stuff! You will most likely have to create your own concurrent utility class which does this for you. Since it is easy to get something wrong when doing concurrent stuff, be careful and make sure you do sufficient research otherwise you might see some behaviour you did not expect. I would suggest the best way to achieve this is to extend Thread and work from there, implementing the void run method. Good luck! (: Apa Quote Link to comment Share on other sites More sharing options...
GPSwap Posted September 4, 2017 Share Posted September 4, 2017 (edited) you might want to change that while to a conditional sleep after you move mouse off screen, that would sleep until out of pizzas or level up message is seen new ConditionalSleep(30000) { @Override public boolean condition() { return !inventory.contains("Plain pizza") || widgets.isVisible(233); } }.sleep(); the 233 widget is the level up message Edited September 4, 2017 by GPSwap Quote Link to comment Share on other sites More sharing options...
dreameo Posted September 4, 2017 Share Posted September 4, 2017 Look at total skill level, whenever it changes, you've leveled up. Quote Link to comment Share on other sites More sharing options...
whipz Posted September 4, 2017 Share Posted September 4, 2017 or you could add to your sleep condition, getWidgets().getWidgetsContainingText("Click here to continue") != null; its what i use could have typos not looking at my IDE Quote Link to comment Share on other sites More sharing options...