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
  • Bank Chest name not showing up


    WolfsRain

    Recommended Posts

    I have programmed in Java before and can handle it well. But today it's my first day at the DreamBOT API. I've been trying to find a solution in the docs here but nothing.

    GOALS:

       1st: Get the name of the chest (just to get a handle on the API after reading throw it for 1 hour)

       2nd: Make the BOT deposit and withdraw from the bank a set of items.

    My goal is to get the name of a bank chest or interact with it (withdraw and deposit). The chest that I am working with is the one at Lumbridge (The bank of Gielinor, name of the chest).

    My Attempt at the code

    import java.util.Arrays;
    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.container.impl.bank.BankLocation;
    import org.dreambot.api.methods.container.impl.bank.BankType;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.wrappers.interactive.Entity;
    import org.dreambot.api.wrappers.interactive.GameObject;
    
    @ScriptManifest(author = "You", name = "BankBOT", version = 0.3, description = "Bank bot test", category = Category.MONEYMAKING)
    public class bankBOT extends AbstractScript {
        public static final int BUCKET = 1925;
        public static final int BUCKET_NOTE = 1926;
        public static final int BUCKET_WATER = 1229;
        public static final int BUCKET_WATER_NOTE = 1230;
        
        
        
        
        public void onStart() {
            log("Starting script...");
        }
    
        public void onExit() {
    
        }
    
        @Override
        public int onLoop() {
        
        //Wlaks there
        getWalking().walk(getBank().getClosestBank(BankType.CHEST));
            
        GameObject chest = getGameObjects().closest(c ->  c != null && c.getName().contains("Bank chest") && c.hasAction("Bank"));
    			if (!getBank().isOpen() && chest != null) {
    				log(chest.getName());
    				sleepUntil(() -> getBank().isOpen(), 2500);
    			}
            
    return Calculations.random(500, 600);
    }
    }

    part of the code is credited here.

    What this code does?

    Well, so far it walks to the chest which is something, but the part where I want to log the name of the chest doesn't work. So if the name doesn't work, I believe withdraw and deposit would fail as well. 

     

    Thanks for the interest in the question!

     

    Link to comment
    Share on other sites

    I'm a pretty bad script tbh but this is what I would do to see where exactly it's stopping. I'd try this.

            GameObject chest = getGameObjects().closest("Bank chest");
            if(chest != null){
                log("Chest is not null.");
                if(chest.hasAction("Bank")){
                    log("Chest has bank option.");
                    if(!getBank().isOpen()){
                        log("Bank is not open");
                        chest.interact("Bank");
                    }
                }
            }

    It's not the best but this way you'll have a log message at every check that you wanted so you can see where exactly it's getting to before it stops.

    Link to comment
    Share on other sites

    If you're banking at somewhere like castlewars you can just walk to the area and use openClosest()

    Will automatically interact with the bank chest. Doesn't work for all locations, but definitely works at a lot of them.

    But as Zawy stated already, the option for bank chest is "Use" and not "Bank"

    Link to comment
    Share on other sites

    2 hours ago, AsBakedAsCake said:

    If you're banking at somewhere like castlewars you can just walk to the area and use openClosest()

    Will automatically interact with the bank chest. Doesn't work for all locations, but definitely works at a lot of them.

    But as Zawy stated already, the option for bank chest is "Use" and not "Bank"

    Yeah, that's what the problem was. I've been messaging him on Discord, we got everything to work. His scripts working well now

    Link to comment
    Share on other sites

    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.