March 16, 20169 yr 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!
March 16, 20169 yr 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
March 16, 20169 yr 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, 20169 yr by Vilius
March 21, 20169 yr 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, 20169 yr by The Hero of Time
March 22, 20169 yr how do you stop it? i guess public void Stop(){ start = 0;} Or just create a pause, stop, resume method. Isn't that hard.
Create an account or sign in to comment