Lewis Posted December 7, 2016 Share Posted December 7, 2016 (edited) 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 December 7, 2016 by Lewis Quote Link to comment Share on other sites More sharing options...
Keven Posted December 7, 2016 Share Posted December 7, 2016 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 Quote Link to comment Share on other sites More sharing options...
Lewis Posted December 7, 2016 Author Share Posted December 7, 2016 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)); } Quote Link to comment Share on other sites More sharing options...
House Posted December 7, 2016 Share Posted December 7, 2016 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. Quote Link to comment Share on other sites More sharing options...
Lewis Posted December 7, 2016 Author Share Posted December 7, 2016 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 Quote Link to comment Share on other sites More sharing options...
House Posted December 7, 2016 Share Posted December 7, 2016 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; Quote Link to comment Share on other sites More sharing options...
Lewis Posted December 7, 2016 Author Share Posted December 7, 2016 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. Quote Link to comment Share on other sites More sharing options...
House Posted December 7, 2016 Share Posted December 7, 2016 i tried a conditional sleep on getLoginStateValue() it still gives the error. I think my ghetto fix was: getInventory().getEmptySlotCount() != -1 Try this Quote Link to comment Share on other sites More sharing options...
Lewis Posted December 7, 2016 Author Share Posted December 7, 2016 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); Quote Link to comment Share on other sites More sharing options...
House Posted December 7, 2016 Share Posted December 7, 2016 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 Quote Link to comment Share on other sites More sharing options...
Lewis Posted December 7, 2016 Author Share Posted December 7, 2016 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 Quote Link to comment Share on other sites More sharing options...