Jump to content

World hopping inventory error


Lewis

Recommended Posts

my script basically does:

 

if shop contains X  && inventory contains X coins {

do w.e 

} else world hop

 

But when i world hop, it loads into the new world with the worlds tab open, causing the inventory counter to glitch out and return it doesnt contain X coins

 

ive tried contitional sleeps for getLoginStateValue() != 20;

then open the inv tab, although it does nothing also.

worlds.hopToP2PWorld();
				new ConditionalSleep(10000) {
					@[member=Override]
					public boolean condition() throws InterruptedException {
						return getClient().getLoginStateValue() != 20;
					}
				}.sleep();
					getTabs().open(Tab.INVENTORY);
			}

i also tried adding this to the top of the buy case:

 

if (!getTabs().getOpen().equals(Tab.INVENTORY)) {
getTabs().open(Tab.INVENTORY);
}
 
which still does nothing
Edited by Lewis
Link to comment
Share on other sites

maybe try

if shop contains X  && inventory contains X coins && getTabs().getOpen().equals(Tab.INVENTORY)) {

 

also still have the open tab statement at the top

i declare the buy case by: if shop area contains my player && inventory contains > 1000 coins

case BUY:
			NPC shop = npcs.closest(npc);
if (!getTabs().getOpen().equals(Tab.INVENTORY)) {
				getTabs().open(Tab.INVENTORY);
				}
			if (shop != null && !store.isOpen()) {
				shop.interact("Trade");
				new ConditionalSleep(10000) {
					@[member=Override]
					public boolean condition() throws InterruptedException {
						return store.isOpen();
					}
				}.sleep();
			} else if (store.getAmount(ITEM) > 0) {
					store.buy(ITEM, 10);
				} else if (store.getAmount(ITEM) > 15) {
					store.buy(ITEM, 10);
				}  else if (store.getAmount(ITEM) == 0
						&& store.getAmount(ITEM) < 15) {
					if (store.isOpen()) {
						store.close();
					}
					worlds.hopToP2PWorld();
					sleep(random(700, 1000));
				}
Link to comment
Share on other sites

You could always have a boolean that you set to true when you considered it time to hop and set it to false once the hop is complete.

im not having an error with it hopping, i have an error after it hops, i.e im at the shop with 100k in inv, it buys items until X remaining (lets say i have 80k remaining) then it will hop.

 

i have another muling state for if inventory has under 20k gp

 

so, after it buys from the shops, world hops it runs to my muling area even though it has 80k in inventory still

Link to comment
Share on other sites

im not having an error with it hopping, i have an error after it hops, i.e im at the shop with 100k in inv, it buys items until X remaining (lets say i have 80k remaining) then it will hop.

 

i have another muling state for if inventory has under 20k gp

 

so, after it buys from the shops, world hops it runs to my muling area even though it has 80k in inventory still

 

ooh, ive come across this before.

 

Basically you are trying to get the items and amounts in your inventory while the client is still loading and returns some funky results.

 

try adding this it your loop:

if (getClient().getLoginState() == LoginState.LOADING || getClient().getLoginState() == LoginState.LOADING_MAP)
return 300;
Link to comment
Share on other sites

 

ooh, ive come across this before.

 

Basically you are trying to get the items and amounts in your inventory while the client is still loading and returns some funky results.

 

try adding this it your loop:

if (getClient().getLoginState() == LoginState.LOADING || getClient().getLoginState() == LoginState.LOADING_MAP)
return 300;

 

 

i tried a conditional sleep on getLoginStateValue()

it still gives the error. 

Link to comment
Share on other sites

I think my ghetto fix was:

 

 

Try this

 

on my conditional sleep like so?:

worlds.hopToP2PWorld();
				log("hopping to new world");
				new ConditionalSleep(10000) {
					@[member=Override]
					public boolean condition() throws InterruptedException {
						return getInventory().getEmptySlotCount() != -1;
					}
				}.sleep();
				log("open inv");
					getTabs().open(Tab.INVENTORY);
Link to comment
Share on other sites

 

on my conditional sleep like so?:

worlds.hopToP2PWorld();
				log("hopping to new world");
				new ConditionalSleep(10000) {
					@[member='Override']
					public boolean condition() throws InterruptedException {
						return getInventory().getEmptySlotCount() != -1;
					}
				}.sleep();
				log("open inv");
					getTabs().open(Tab.INVENTORY);

 

Just. add a check in your loop and return before you do anything if getInventory().getEmptySlotCount() == -1

Link to comment
Share on other sites

Just. add a check in your loop and return before you do anything if getInventory().getEmptySlotCount() == -1

cant get it to work still

tried waiting on widgets, login status' if inventory is open or not

all dont work

 

(it is calling open inventory before it has finished loading into the new world)

and i would rather avoid a static sleep to avoid lag educed errors

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