Skip 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.

Conditional sleep error

Featured Replies

I'm copy and pasting the conditional sleep all the times I need it, but it's giving me the error "The method condition() of type Enchanter must override or implement a supertype method." I've commented where the errors are. Code:

    private void withdrawAmulets() {
        ctx.log("Withdrawing Topaz amulets");

        if (!ctx.getEquipment().isWearingItem(EquipmentSlot.WEAPON, "Staff of fire")) {
    		if(ctx.getBank().withdraw("Topaz amulet", 26)){
    	        new ConditionalSleep(1000,1250) {
    	        @Override
    	          public boolean condition() {
    	              return !needAmulets();
    	          }
    	      }.sleep();
    	    }
        } else {
    		if(ctx.getBank().withdraw("Topaz amulet", 26)){
    	        new ConditionalSleep(1000,1250) { //Syntax error, insert "}" to complete MethodBody
    	        @Override
    	          public boolean condition() { //The method condition() of type Enchanter must override or implement a supertype method
    	              return !needAmulets();
    	          }
    	      }.sleep(); // Syntax error on token "}", delete this token
    	    }
        } // Syntax error on token "}", { expected
    }

Help appreciated :)

I don't want to get too into detail with the problem you're having because there seem to be more than just the override error. But with a quick glance here's what I can tell:

// Syntax error on token "}", { expected

Your script has 10 opening and 12 closing braces which is causing this error, make sure you're closing all your braces properly.

 

//The method condition() of type Enchanter must override or implement a supertype method

If i recall correctly this means that your parameters don't match up with the class you're trying to override:

//the super class/method being overrun
class foo (int x, String s) {
	...
}

//the class/method you're wanting to override with
class foo (int y, int x) {
	...
}

Notice how the parameters are out of order and/or don't match up, since the signatures aren't a match there's *nothing* to be overrun. My best guess as to what's causing it is the time parameters in your conditional sleep declaration. AFAIK conditional sleep only takes one parameter for time instead of a range. You could try using random() to generate a number in that range and use that instead.

Edited by luciuspragg

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.