Jump to content

Help with karamja store please


semanji

Recommended Posts

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();
}
Link to comment
Share on other sites

 

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