Lychees Posted October 4, 2017 Share Posted October 4, 2017 (edited) Hello guys, Im trying to get back into scripting and my first project is a pizza base maker but im trying to add conditionalSleep but i can get it to work. if (new ConditionalSleep(1200) { public boolean condition() throws InterruptedException { return Main.this.myPlayer().isAnimating(); } }.sleep()) { } } The problem is when i make a pizza base my player isnt Animating. (this.inventory.getAmount(new String[] { "Pizza base" }) == 9) Ive also treid to work with the amount in inventory but still cant figure it out. some help would be great ;) Edited October 4, 2017 by Lychees Quote Link to comment Share on other sites More sharing options...
HunterRS Posted October 4, 2017 Share Posted October 4, 2017 (edited) EDIT: I am stupid Edited October 4, 2017 by HunterRS 1 Quote Link to comment Share on other sites More sharing options...
HeyImJamie Posted October 4, 2017 Share Posted October 4, 2017 16 minutes ago, Lychees said: Hello guys, Im trying to get back into scripting and my first project is a pizza base maker but im trying to add conditionalSleep but i can get it to work. if (new ConditionalSleep(1200) { public boolean condition() throws InterruptedException { return Main.this.myPlayer().isAnimating(); } }.sleep()) { } } The problem is when i make a pizza base my player isnt Animating. (this.inventory.getAmount(new String[] { "Pizza base" }) == 9) Ive also treid to work with the amount in inventory but still cant figure it out. some help would be great ;) If there's an animation but it isn't constant you can make use of timers, I believe Juggles has a snippet in the snippet section. If there's not an animation, you can make use of the inventory. 1 Quote Link to comment Share on other sites More sharing options...
Apaec Posted October 4, 2017 Share Posted October 4, 2017 21 minutes ago, HunterRS said: the conditional sleep should not be inside the if, it should accure if the if statement is true. Example: if(getBank().depositAll()){ new ConditionalSleep(2000) { @Override public boolean condition() { return getInventory().isEmpty(); } }.sleep(); } Why shouldn't the conditional sleep be inside the if? ConditionalSleep#sleep returns a boolean (relating to the success), and as such can be used for conditional/ternary expressions. @Lychees You need to find some other way to check this! Perhaps implement some kind of inventory listener of your own design, or have a concurrent timer counting the time since a pizza base was last made? -Apa 1 Quote Link to comment Share on other sites More sharing options...
HunterRS Posted October 4, 2017 Share Posted October 4, 2017 23 minutes ago, Apaec said: Why shouldn't the conditional sleep be inside the if? ConditionalSleep#sleep returns a boolean (relating to the success), and as such can be used for conditional/ternary expressions. @Lychees You need to find some other way to check this! Perhaps implement some kind of inventory listener of your own design, or have a concurrent timer counting the time since a pizza base was last made? -Apa *facepalm*, You are right, I should go to sleep Lol Quote Link to comment Share on other sites More sharing options...
sp3cpk Posted October 4, 2017 Share Posted October 4, 2017 new ConditionalSleep(25000, 4000) { @Override public boolean condition() throws InterruptedException { return !getInventory().contains("Pot of flour", "Jug of water") || getDialogues().inDialogue(); } }.sleep(); Quote Link to comment Share on other sites More sharing options...