Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • need help with slotContains


    monkeyez

    Recommended Posts

    Posted
    if (getInventory().slotContains(27,"Maple longbow (u)")) {
        sleep(Calculations.random(1500,25000));
        getBank().openClosest();
    }

    This code seems to ignore the if statement and instead it consistently opens the bank. help

    Posted

    Try using a Filter instead of passing a String:

    if (getInventory().slotContains(27, item -> item.getName().endsWith("(u)"))){

    If that doesn't work then you can try another method of checking if your inventory is full of unstrung maple longbows:

    final String UNSTRUNG_LONGBOW = "Maple longbow (u)";
    if(getInventory().isFull() && getInventory().onlyContains(item -> item.getName().contains(UNSTRUNG_LONGBOW))){

    Just a side note, you can use the method sleepUntil() to have your script sleep until the bank window is opened:

    sleepUntil(() -> getBank.isOpen(), 2000);

     

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.