Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Cooking Conditional Sleep

Featured Replies

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!

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.

 
  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

  • Author

Thank you so much for the help! Now that I've slept for a bit, I don't know  why I didn't think of either of these things!

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

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.