Jump to content

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


Recommended Posts

Posted

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

Posted (edited)

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
Posted (edited)

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
Posted

 

&& 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)

Posted (edited)

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
Posted

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

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...