Jump to content

Help with karamja store please


Recommended Posts

Posted

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();
}
Posted (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 by Explv
  • Like 1

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