semanji Posted April 9, 2016 Posted April 9, 2016 store.isOpen() never returns true, what shall i do? NPC shopkeeper = npcs.closest(shop, "Jiminua"); if (shopkeeper != null) { new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return shopkeeper.interact("Trade"); } }.sleep(); if (getStore().isOpen()) { //doesnt return true log("store open"); if (getStore().getAmount(7936) == 100) { long amount = inventory.getAmount(7936); if (getStore().interact("Buy 10", 7936)) { new ConditionalSleep(1250) { @Override public boolean condition() throws InterruptedException { return amount < inventory.getAmount(7936); } }.sleep(); }
semanji Posted April 9, 2016 Author Posted April 9, 2016 Im pretty sure its store.isOpen() Does not work with either
Muffins Posted April 9, 2016 Posted April 9, 2016 NPC shopkeeper = npcs.closest(shop, "Jiminua"); what function does "shop" have in this.....? 1
semanji Posted April 9, 2016 Author Posted April 9, 2016 NPC shopkeeper = npcs.closest(shop, "Jiminua"); what function does "shop" have in this.....? this th area
Explv Posted April 9, 2016 Posted April 9, 2016 (edited) store.isOpen() never returns true, what shall i do? NPC shopkeeper = npcs.closest(shop, "Jiminua"); if (shopkeeper != null) { new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return shopkeeper.interact("Trade"); } }.sleep(); if (getStore().isOpen()) { //doesnt return true log("store open"); if (getStore().getAmount(7936) == 100) { long amount = inventory.getAmount(7936); if (getStore().interact("Buy 10", 7936)) { new ConditionalSleep(1250) { @Override public boolean condition() throws InterruptedException { return amount < inventory.getAmount(7936); } }.sleep(); } I have confirmed getStore.isOpen() 100% works at Jiminua's store. Also using an area, when checking for the closest "Jiminua" is unnecessary, there is only one Jiminua, and if she leaves the area you have specified it will return null. The issue lies elsewhere in your code. Item ID 7936 is Pure essence: https://rsbuddy.com/exchange?id=7936& If the shop does not have 100 Pure essence, your script will not do anything. For clarity you should use Strings instead of IDs for item names. public void buyPureEssence(){ if(!S.getStore().isOpen()){ openStore(); } else if(S.getStore().contains("Pure essence"){ buy10(); } } private void buy10(){ long invPureEssAmount = S.getInventory().getAmount("Pure essence"); S.getStore().interact("Buy 10", "Pure essence"); new ConditionalSleep(2000) { @Override public boolean condition() throws InterruptedException { return S.getInventory().getAmount("Pure essence") > invPureEssAmount; } }.sleep(); } private void openStore(){ NPC shopkeeper = S.npcs.closest("Jiminua"); if(shopkeeper != null){ shopkeeper.interact("Trade"); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return S.getStore().isOpen(); } }.sleep(); } } Edited April 9, 2016 by Explv 1