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 this code not working?

Featured Replies

Hi, 

Is there any reason why it's not sipping a pot when my run energy goes below 30%? Ignore the fact that I only have a 4 dose on there, I'll use an array later to add all doses later.

public void drinkPots() throws InterruptedException	{

		if (settings.getRunEnergy() < 30) {
			getInventory().interact("Drink", "Energy potion(4)");
			sleep(random(50, 500));
					}
					new ConditionalSleep(4000, 200) {
					    @Override
					    public boolean condition() {
					        return (settings.getRunEnergy() > 90);
					    }
					}.sleep();
				  }

 

  • Author
3 minutes ago, D9BLADEE said:

You tried getSettings() rather than settings? That works for me

Lemme give that a go. I'll report back.

It worked. Fancy that. ^^ 

Thanks.

I wonder why settings. didn't work. o_O

Edited by Lol_marcus

18 minutes ago, Lol_marcus said:

Lemme give that a go. I'll report back.

It worked. Fancy that. ^^ 

Thanks.

I wonder why settings. didn't work. o_O

magic m8 

With calling settings you are calling the variable itself with getSettings() you are calling a getter that may be doing more than just returning the variable itself. In most cases calling just settings will work but depending on when and where you are calling the settings variable it’s context could possibly not be the current bot context so it is unable to accurately retrieve the information needed while not throwing any errors. To verify this, print what the current value of that call is, to the console.

8 minutes ago, BravoTaco said:

With calling settings you are calling the variable itself with getSettings() you are calling a getter that may be doing more than just returning the variable itself. In most cases calling just settings will work but depending on when and where you are calling the settings variable it’s context could possibly not be the current bot context so it is unable to accurately retrieve the information needed while not throwing any errors. To verify this, print what the current value of that call is, to the console.

i knew that.. 

:troll:

On 5/25/2020 at 5:32 PM, Lol_marcus said:

I'll use an array later to add all doses later.

This is not related to your actual question, just a suggestion:

Try using a Filter<Item> to grab all the energy pots at various doses, if you haven't already

Edited by Ace99

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.