Jump to content

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


Lewis

Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

 

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

                    }
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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