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.

getInventory().getAmount("Coins") <= 1000 returning a false true after world hop

Featured Replies

Still having an issue with my case being called even though inventory contains over 1k coins after world hopping

 

if (getInventory().getAmount("Coins") <= 1000
				&& !GE.contains(myPlayer()))
			return State.WALKGE;

is the case being called after it world hops

 

my world hop code:

 else if (store.getAmount(ITEM) == 0
						&& store.getAmount(ITEM) < 215) {
					if (store.isOpen()) {
						store.close();
					}
					worlds.hopToP2PWorld();
					new ConditionalSleep(20000) {
						@[member=Override]
						public boolean condition() throws InterruptedException {
							return widgets.isVisible(548, 62);
						}
					}.sleep();
					getTabs().open(Tab.INVENTORY);
				}

note*: The conditional sleep widget is, the loading text you get when world hopping / hoping for a ghetto fix

(where current world would be)

World_Switcher_in_OSRS.png

  • Author

your inventory isnt open so it doesnt know how many it has. probably returns a -1, which is less than 1000

yeah i tried the conditional sleep after hopping, then open inv like in example code

yet it still does it

your inventory isnt open so it doesnt know how many it has. probably returns a -1, which is less than 1000

 

how did you obtain the scripter rank?

  • Author

how did you obtain the scripter rank?

such on topic, much relevance

such on topic, much relevance

imateamcape already answered the question

  • Author

imateamcape already answered the question

i know it was being falsely called already. I'm looking for a solution to the problem. So no, he hasnt answered the question yet.

Please refrain from any unrelated posts

Edited by Lewis

i know it was being falsely called already. I'm looking for a solution to the problem. So no, he hasnt answered the question yet.

Please refrain from any unrelated posts

 

sorry lel didnt read.

 

i just found out that ur op

how did you obtain the scripter rank?

 

stay on topic. no more about this in this thread.

 

http://osbot.org/forum/topic/82806-new-scripter-ranks/

 

yeah i tried the conditional sleep after hopping, then open inv like in example code

yet it still does it

 

&& inventory.getAmount("Coins") >= 0 is probably a reasonable (lil ghetto) fix thatll work

Edited by Imateamcape

Found these on another thread (think credit goes to Explv)

public boolean isLoggedIn() {
        return
                isHopping() ||
                        getClient().getLoginStateValue() == 30 ||
                        getClient().isLoggedIn() ||
                        isLoading();
    }

    public boolean isHopping() {
        return
                getClient().getLoginStateValue() == 45 ||
                        getClient().getLoginStateValue() == 25;
    }

    public boolean isLoading() {
        return
                getClient().getLoginState() == Client.LoginState.LOADING ||
                        getClient().getLoginState() == Client.LoginState.LOADING_MAP;
    }

Should help you to wait until you're done hopping.

Edited by Night

  • Author

 

&& inventory.getAmount("Coins") >= 0 is probably a reasonable (lil ghetto) fix thatll work

 

Tried it and it still does it :/

ive even added:

if (!getTabs().getOpen().equals(Tab.INVENTORY)) {
				getTabs().open(Tab.INVENTORY);
			}

in my ge walker case

 

It seems to be when world hopping lags slightly, causing it not to reopen inventory (even though i have open in in walking case too)

Tried it and it still does it :/

ive even added:

if (!getTabs().getOpen().equals(Tab.INVENTORY)) {
				getTabs().open(Tab.INVENTORY);
			}

in my ge walker case

 

It seems to be when world hopping lags slightly, causing it not to reopen inventory (even though i have open in in walking case too)

 

 

imagine your current code in the walk_to_ge state is just walkToGE();

 

say this:

 

if(inventory.isOpen()) {

    walkToGE();

} else {

    tabs.open(Tab.INVENTORY);

}

 

and let it go thru the loop again

 

Found these on another thread (think credit goes to Explv)

public boolean isLoggedIn() {
        return
                isHopping() ||
                        getClient().getLoginStateValue() == 30 ||
                        getClient().isLoggedIn() ||
                        isLoading();
    }

    public boolean isHopping() {
        return
                getClient().getLoginStateValue() == 45 ||
                        getClient().getLoginStateValue() == 25;
    }

    public boolean isLoading() {
        return
                getClient().getLoginState() == Client.LoginState.LOADING ||
                        getClient().getLoginState() == Client.LoginState.LOADING_MAP;
    }

Should help you to wait until you're done hopping.

 

the issue isnt that hes still hopping - it's that the inventory is returning a -1 value for the coins in the inventory

Edited by Imateamcape

  • Author

Can confirm this works. 

I use it in my scripts as a Ghetto fix to it. 

 

how do you use it?

i tried:

if (getInventory().getAmount("Coins") <= 1000 && inventory.getAmount("Coins") >= 0
				&& !GE.contains(myPlayer()))
			return State.WALKGE;

and it was still doing it :s

how do you use it?

i tried:

if (getInventory().getAmount("Coins") <= 1000 && inventory.getAmount("Coins") >= 0
				&& !GE.contains(myPlayer()))
			return State.WALKGE;

and it was still doing it unsure.png

Has to be a > can't be a >= bc it's equal to 0 when you are hopping

 

Just basic math logic :P

My code

  if (getInventory().getAmount("Coins") > 0 && getInventory().getAmount("Coins") < 10000) {

                        getStatus = ("Walk to GE");

                        walking.walkPath(toGrandExchange);

                    }

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.