Jump to content

How to check if bot is cooking


GaetanoH

Recommended Posts

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!

Link to comment
Share on other sites

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

  • Like 1
Link to comment
Share on other sites

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 miliseconds

Actually change the time it takes to cook one and the delay in between, 4000ms should work.

Edited by Vilius
  • Like 3
Link to comment
Share on other sites

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 miliseconds

Actually 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 by The Hero of Time
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...