GaetanoH Posted March 16, 2016 Share Posted March 16, 2016 Hello I have some questions regarding the animation when cooking, so I get it when your cooking you're isAnimating() == true but when your character "gets up" to get the other fish it stops animating so my bot spams click the fish on the fire... Any way on how I can fix this, using a conditional sleep isn't very good because I always have a random number of trouts/salmon in my inventory so this would make the bot slow. Thanks in advance! Quote Link to comment Share on other sites More sharing options...
progamerz Posted March 16, 2016 Share Posted March 16, 2016 Hello I have some questions regarding the animation when cooking, so I get it when your cooking you're isAnimating() == true but when your character "gets up" to get the other fish it stops animating so my bot spams click the fish on the fire... Any way on how I can fix this, using a conditional sleep isn't very good because I always have a random number of trouts/salmon in my inventory so this would make the bot slow. Thanks in advance! Put sleeps like 100,200 1 Quote Link to comment Share on other sites More sharing options...
Vilius Posted March 16, 2016 Share Posted March 16, 2016 (edited) Timer class: public class Timer { private long period; private long start; public Timer(long period) { this.period = period; this.start = System.currentTimeMillis(); } public long getElapsed() { return System.currentTimeMillis() - this.start; } public long getRemaining() { return this.period - this.getElapsed(); } public boolean isRunning() { return this.getElapsed() <= this.period; } public void setPeriod(long period) { this.period = period; } public void reset() { this.start = System.currentTimeMillis(); } public static String format(long milliSeconds) { long secs = milliSeconds / 1000L; return String.format("%02d:%02d:%02d", new Object[] { Long.valueOf(secs / 3600L), Long.valueOf(secs % 3600L / 60L), Long.valueOf(secs % 60L) }); } }Then simply implement it like this: Timer timer = new Timer(4000); if(myPlayer().isAnimating()){ timer.reset(); } if(timer.getElapsed() > 4000){ //do stuff } That should work, just change the 4000 into the time it takes to cook the whole inventory in milisecondsActually change the time it takes to cook one and the delay in between, 4000ms should work. Edited March 16, 2016 by Vilius 3 Quote Link to comment Share on other sites More sharing options...
mudrlantik Posted March 16, 2016 Share Posted March 16, 2016 You could just add timer and reset it everytime you receive new cooked food. Quote Link to comment Share on other sites More sharing options...
The Hero of Time Posted March 21, 2016 Share Posted March 21, 2016 (edited) Timer class: public class Timer { private long period; private long start; public Timer(long period) { this.period = period; this.start = System.currentTimeMillis(); } public long getElapsed() { return System.currentTimeMillis() - this.start; } public long getRemaining() { return this.period - this.getElapsed(); } public boolean isRunning() { return this.getElapsed() <= this.period; } public void setPeriod(long period) { this.period = period; } public void reset() { this.start = System.currentTimeMillis(); } public static String format(long milliSeconds) { long secs = milliSeconds / 1000L; return String.format("%02d:%02d:%02d", new Object[] { Long.valueOf(secs / 3600L), Long.valueOf(secs % 3600L / 60L), Long.valueOf(secs % 60L) }); } }Then simply implement it like this: Timer timer = new Timer(4000); if(myPlayer().isAnimating()){ timer.reset(); } if(timer.getElapsed() > 4000){ //do stuff } That should work, just change the 4000 into the time it takes to cook the whole inventory in milisecondsActually change the time it takes to cook one and the delay in between, 4000ms should work. how do you stop it? i guess public void Stop() { start = 0; } Edited March 21, 2016 by The Hero of Time Quote Link to comment Share on other sites More sharing options...
Psvxe Posted March 22, 2016 Share Posted March 22, 2016 how do you stop it? i guess public void Stop(){ start = 0;} Or just create a pause, stop, resume method. Isn't that hard. Quote Link to comment Share on other sites More sharing options...
The Hero of Time Posted March 22, 2016 Share Posted March 22, 2016 Or just create a pause, stop, resume method. Isn't that hard. i know 1 Quote Link to comment Share on other sites More sharing options...