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.

Why is my conditional sleep activating before task complete?

Featured Replies

My conditional sleep is executing, before it's completed the set task above it, I'm not sure why though?

 

Example of code  ( This was my first attempt ) - ( but it kept running the conditional sleep, before even clicking inventory tab )

            getTabs().open(Tab.INVENTORY);

            new ConditionalSleep(15000, 600) {
                @Override
                public boolean condition() {
                    log("Wait for Fishing tut!");
                    RS2Widget FishingWidg = getWidgets().getWidgetContainingText(263, "Fishing");
                    return FishingWidg != null && FishingWidg.isVisible();
                }
            }.sleep();

This was my second attempt -

        getTabs().open(Tab.INVENTORY);

        if(getTabs().isOpen(Tab.INVENTORY)) {

            new ConditionalSleep(15000, 600) {
                @Override
                public boolean condition() {
                    log("Wait for Fishing tut!");
                    RS2Widget FishingWidg = getWidgets().getWidgetContainingText(263, "Fishing");
                    return FishingWidg != null && FishingWidg.isVisible();
                }
            }.sleep();

        }

But still the same issue...?

It's strange though because sometimes it works correctly & sometimes it doesn't..

23 minutes ago, Jar said:

 


        getTabs().open(Tab.INVENTORY);

        if(getTabs().isOpen(Tab.INVENTORY)) {

            new ConditionalSleep(15000, 600) {
                @Override
                public boolean condition() {
                    log("Wait for Fishing tut!");
                    RS2Widget FishingWidg = getWidgets().getWidgetContainingText(263, "Fishing");
                    return FishingWidg != null && FishingWidg.isVisible();
                }
            }.sleep();

        }

But still the same issue...?

 

What do you mean by still the same issue? Does the ConditionalSleep never get executed in this case?

If the inventory tab is already open, the bot won't click on the inventory tab.

1 minute ago, Juggles said:

Why are you using widgets when you can sleep until getTabs.getOpen==Tabs.Inventory?

 


He shouldn't be using either. getTabs().open(Tab) will sleep until the tab is open anyway.

+ He should be using configs like here: https://github.com/Explv/Tutorial-Island/blob/master/src/sections/SurvivalSection.java#L35

Edited by Explv

  • Author
1 minute ago, Explv said:

 

What do you mean by still the same issue? Does the ConditionalSleep never get executed in this case?

If the inventory tab is already open, the bot won't click on the inventory tab.

That's the strange thing, it still executes ConditionalSleep even though inventory is not open..

  • Author
3 minutes ago, Juggles said:

Why are you using widgets when you can sleep until getTabs.getOpen==Tabs.Inventory?

 

The conditional sleep isn't waiting for the inventory tab to be open... it's waiting for the next stage of the tutorial which in this case is " Fishing " which appears in chatbox after clicking inventory tab

44 minutes ago, Jar said:

The conditional sleep isn't waiting for the inventory tab to be open... it's waiting for the next stage of the tutorial which in this case is " Fishing " which appears in chatbox after clicking inventory tab

Sorry I'm on my phone. 

If you're doing tut island then use Configs

  • Author
9 minutes ago, Juggles said:

Sorry I'm on my phone. 

If you're doing tut island then use Configs

No problem, I managed to fix it by adding a if statement -

 

if(!getTabs().isOpen(Tab.INVENTORY)) { }

which made it work, but I still don't see why that is necessary, i should be able to just call " getTabs().open(Tab.INVENTORY); " but never mind it works now i guess..

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.