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 Withdraw Method doesn't work


    badramen

    Recommended Posts

    19 hours ago, fallacy87 said:

    there are 2 methods for onStart, if it is 

        @Override
        public void onStart(String... params) {
            super.onStart(params);
        }

    then you are using the onstart with parameters and isn't firing. If you are using the one without onStart(String...params) then it is only going to fire 1 time, at the start of the script. You should read the API documentation on these to get a better understanding of what you are doing in your code. Put it in the loop and give it some conditions to detect it like Smokeyjay posted above.

     

    It's not like it's not firing, it's literally Bank.close() method doing nothing plain and simple. I know java and have read the docs lmao (not like there is much to read up on)

     

    Snippet

            if(!Bank.open()) {
                Logger.log("Open near a bank");
                stop();
            }
    
            /* Clean Slate */
            Bank.depositAllEquipment();
            Bank.depositAllItems();
    
            Bank.withdraw("Bandos godsword");
            Bank.withdraw("Fire cape (l)");
    
            Bank.close();

     

    Just the bank.close() bit not working anymore

    The purpose of opening the bank on start is part of automatically analysing a players bank to determine the best gear that they can be using and auto-generating loadouts for various bosses (i.e. vorkath in this case but can be expanded over time).

    Whatever loop it runs in is compeletely irrelevant to the problem

     

    Link to comment
    Share on other sites

    6 hours ago, badramen said:

     

    It's not like it's not firing, it's literally Bank.close() method doing nothing plain and simple. I know java and have read the docs lmao (not like there is much to read up on)

     

    Snippet

            if(!Bank.open()) {
                Logger.log("Open near a bank");
                stop();
            }
    
            /* Clean Slate */
            Bank.depositAllEquipment();
            Bank.depositAllItems();
    
            Bank.withdraw("Bandos godsword");
            Bank.withdraw("Fire cape (l)");
    
            Bank.close();

     

    Just the bank.close() bit not working anymore

    The purpose of opening the bank on start is part of automatically analysing a players bank to determine the best gear that they can be using and auto-generating loadouts for various bosses (i.e. vorkath in this case but can be expanded over time).

    Whatever loop it runs in is compeletely irrelevant to the problem

     

    Well, I was just trying to help you out in your code, not insult you. Feel free to correct me if I'm wrong (this might be practiced here, I recently came over from another API less than a week ago), but onStart should be used to initialize code that is meant to be ran only 1 time. For example, adding a GameTickListener to the instance or updating your global parameters(if params were given) and not generally used to control the bot. While your intent is only to check the equipment 1 time and that's what onStart technically does, the better approach might be to set a global boolean to false and in the loop set it to true once the conditions have been met. This allows you to control the bot way more efficiently and if a misfire does happen the loop comes back and does the action in the near future.

        boolean equipmentChecked = false;
    
        @Override
        public int onLoop() {
            if(!equipmentChecked){
                // do your equipment check,
                // set equipmentChecked = true; once your script finds what it is looking for
                // return -1 if the user does not meet the requirements
                return 1;
            }
    
            // run the rest of your code once the equipment is checked
            // this will not run until the equipmentChecked boolean equals true
    
            return 1;
        }

     

    Link to comment
    Share on other sites

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