Jump to content

Cooking Conditional Sleep


Recommended Posts

Posted

I'm working on a fishing and cooking script, and I want the bot to sleep until all of the raw trout in my inventory is cooked. The code that i have for my conditional sleep is: 

  1.  if (cookMenu != null && cookMenu.isVisible()) {
  2.                     cookMenu.interact("Cook All");
  3.                     new ConditionalSleep(600000) {
  4.                         @Override
  5.                         public boolean condition() throws InterruptedException {
  6.                             return inventory.onlyContains(314309331343333) || !myPlayer().isAnimating() ||getDialogues().inDialogue();
  7.                         }
  8.                     }.sleep();

The problem is that it doesn't sleep, and continually selects the trout, uses it on the fire, and clicks "Cook All".

 

Any help is appreciated!

Posted

I'm working on a fishing and cooking script, and I want the bot to sleep until all of the raw trout in my inventory is cooked. The code that i have for my conditional sleep is: 

  1.  if (cookMenu != null && cookMenu.isVisible()) {
  2.                     cookMenu.interact("Cook All");
  3.                     new ConditionalSleep(600000) {
  4.                         @Override
  5.                         public boolean condition() throws InterruptedException {
  6.                             return inventory.onlyContains(314309331343333) || !myPlayer().isAnimating() ||getDialogues().inDialogue();
  7.                         }
  8.                     }.sleep();

The problem is that it doesn't sleep, and continually selects the trout, uses it on the fire, and clicks "Cook All".

 

Any help is appreciated!

make it return if inventory doesn't contain the raw trout so it will stay sleeping untill that.

Posted (edited)
 
  new ConditionalSleep(60000) {
                    @Override
                    public boolean condition() throws InterruptedException {
                        return !getInventory.contains("Raw trout") || getDialogue().inDialogue();
                    }
                }.sleep();

 


I believe your guy stops animating between fishes cooked. I'm not sure on this but that might be why it didn't work for you. 

Edited by lg_juggles
Posted

I'm working on a fishing and cooking script, and I want the bot to sleep until all of the raw trout in my inventory is cooked. The code that i have for my conditional sleep is:

  • if (cookMenu != null && cookMenu.isVisible()) {

  • cookMenu.interact("Cook All");

  • new ConditionalSleep(600000) {

  • @Override

  • public boolean condition() throws InterruptedException {

  • return inventory.onlyContains(314, 309, 331, 343, 333) || !myPlayer().isAnimating() ||getDialogues().inDialogue();

  • }

  • }.sleep();

The problem is that it doesn't sleep, and continually selects the trout, uses it on the fire, and clicks "Cook All".

Any help is appreciated!

In the future please use the code tags when posting code on OSBot. It's the button that looks like <>

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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