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
  • Custom Account Handler


    Mojo

    Recommended Posts

    I'm attempting to set up a feature in my script that will allow for once an account is banned, it will fetch for the next one in order of a txt file. Logging it in using the same script. Each client would have their own txt file of accounts to choose from. Just need to know the right direction to go in. I would use parameters in order to select the txt file for that specific client to use.

     

    I saw on the forums that for this to be done I would need to disable and re-enable some of the built in account handlers.

     

    Any help is appreciated, thanks in advance.

     

     

    Link to comment
    Share on other sites

    public class AutoLogin {
        private Rectangle existingUserBox;
        private Rectangle cancelBox; // when password is wrong
        private Rectangle tryAgainBox; // when password is wrong
        private Rectangle backBox; // when on recover password screen
        public static String username;
        public static String password;
    
        private AbstractScript script;
        public AutoLogin(AbstractScript script) {
            existingUserBox = new Rectangle(397, 280, 529 - 397, 30);
            cancelBox = new Rectangle(396, 308, 529 - 397, 30);
            tryAgainBox = new Rectangle(315, 260, 425 - 291, 30);
            backBox = new Rectangle(396, 305, 528 - 390, 30);
            this.script = script;
        }
        private boolean isAccountDisabled() {
            return script.getClient().getMessage0().contains("disabled");
        }
    
        public boolean isAccountLocked() {
            return script.getClient().getMessage0().contains("stolen");
        }
    
        private boolean isNonMember() {
            return script.getClient().getMessage0().contains("members account");
        }
    
        private boolean rsUpdated() {
            return script.getClient().getMessage1().contains("updated");
        }
    
        private boolean isPasswordWrong() {
            return script.getClient().getLoginIndex() == 3;
        }
    
        private boolean forgotPasswordScreen() {
            return script.getClient().getLoginIndex() == 5;
        }
    
        private boolean clickExistingUser() {
            return script.getMouse().click(existingUserBox);
        }
    
        private boolean clickCancel() {
            return script.getMouse().click(cancelBox);
        }
    
        private boolean clickTryAgain() {
            return script.getMouse().click(tryAgainBox);
        }
    
        private boolean clickBack() {
            return script.getMouse().click(backBox);
        }
    
        private void handleDisabled() {
            script.log("Disabled");
            script.stop();
        }
    
        private boolean isConnecting() {
            return script.getClient().getMessage1().contains("Connecting");
        }
    
    
        private void handleWrongPassword() {
            Main.state = "Wrong pass";
            clickTryAgain();
            clickCancel();
        }
    
        private void enterUserName() {
            if (username != null) {
                script.getKeyboard().type(username);
            } else {
                readAccounts(script);
            }
        }
    
        private void enterPassword() {
            if (password != null) {
                script.getKeyboard().type(password);
            } else {
                readAccounts(script);
            }
        }
    
        private boolean onSecondScreen() {
            return script.getClient().getGameStateID() == 30;
        }
    
        private boolean clickPlay() {
            return script.getWidgets().getWidgetChild(378, 17).interact();
        }
    
        public void login() {
    
            if (!onSecondScreen()) {
                int index = script.getClient().getLoginIndex();
                switch (index) {
                    case 0:
                        Main.state = "Clicking Existing User";
                        readAccounts(script);
                        clickExistingUser();
                        break;
    
                    case 1:
                        Main.state = "Clicking Canceling";
                        clickCancel();
                        break;
    
                    case 2:
    
                        if (isAccountLocked()) {
                            Main.state = "Locked";
                            script.log(username + " is locked");
                            clickCancel();
                        }
    
                        if (isAccountDisabled()) {
                            Main.state = "Disabled";
                            script.log(username + " is disabled");
                            clickCancel();
                        }
    
                        if (isNonMember()) {
                            Main.state = "Account is non-member.. stopping script";
                            script.stop();
                        }
    
                        if (rsUpdated()) {
                            Main.state = "RS update";
                            script.log("RS Update");
                            script.stop();
                        }
    
                        if (!isConnecting() && !isAccountDisabled()) {
                            Main.state = "Entering account details";
                            enterUserName();
                            enterPassword();
                        }
                        break;
                    case 3:
                        if (isPasswordWrong()) {
                            Main.state = "Wrong password";
                            handleWrongPassword();
                        }
                        break;
                    case 5:
                        if (forgotPasswordScreen()) {
                            Main.state = "Clicked forgot password";
                            clickBack();
                        }
                }
            }
        }
    }
    

    You can look up how to read a text file, and find plenty of results on stack overflow.

    Link to comment
    Share on other sites

     

     

    [code=auto:0]public AutoLogin(AbstractScript script) {
    
    existingUserBox = new Rectangle(397, 280, 529 - 397, 30);
    
    cancelBox = new Rectangle(396, 308, 529 - 397, 30);
    
    tryAgainBox = new Rectangle(315, 260, 425 - 291, 30);
    
    backBox = new Rectangle(396, 305, 528 - 390, 30);
    
    this.script = script;
    
    }
    
    private boolean isAccountDisabled() {
    
    return script.getClient().getMessage0().contains("disabled");
    
    }
    
    
    
    public boolean isAccountLocked() {
    
    return script.getClient().getMessage0().contains("stolen");
    
    }
    
    
    
    private boolean isNonMember() {
    
    return script.getClient().getMessage0().contains("members account");
    
    }
    
    
    
    private boolean rsUpdated() {
    
    return script.getClient().getMessage1().contains("updated");
    
    }
    
    
    
    private boolean isPasswordWrong() {
    
    return script.getClient().getLoginIndex() == 3;
    
    }
    
    
    
    private boolean forgotPasswordScreen() {
    
    return script.getClient().getLoginIndex() == 5;
    
    }
    
    
    
    private boolean clickExistingUser() {
    
    return script.getMouse().click(existingUserBox);
    
    }
    
    
    
    private boolean clickCancel() {
    
    return script.getMouse().click(cancelBox);
    
    }
    
    
    
    private boolean clickTryAgain() {
    
    return script.getMouse().click(tryAgainBox);
    
    }
    
    
    
    private boolean clickBack() {
    
    return script.getMouse().click(backBox);
    
    }
    
    
    
    private void handleDisabled() {
    
    script.log("Disabled");
    
    script.stop();
    
    }
    
    
    
    private boolean isConnecting() {
    
    return script.getClient().getMessage1().contains("Connecting");
    
    }
    
    
    
    
    
    private void handleWrongPassword() {
    
    Main.state = "Wrong pass";
    
    clickTryAgain();
    
    clickCancel();
    
    }
    
    
    
    private void enterUserName() {
    
    if (username != null) {
    
    script.getKeyboard().type(username);
    
    } else {
    
    readAccounts(script);
    
    }
    
    }
    
    
    
    private void enterPassword() {
    
    if (password != null) {
    
    script.getKeyboard().type(password);
    
    //script.sleep(5000); // added this sleep in so it could check player settings..
    
    } else {
    
    readAccounts(script);
    
    }
    
    }
    
    
    
    private boolean onSecondScreen() {
    
    return script.getClient().getGameStateID() == 30;
    
    }
    
    
    
    private boolean clickPlay() {
    
    return script.getWidgets().getWidgetChild(378, 17).interact();
    
    }
     
    public void login() {
    
    
    
    if (!onSecondScreen()) {
    
    int index = script.getClient().getLoginIndex();
    
    switch (index) {
    
    case 0:
    
    Main.state = "Clicking Existing User";
    
    readAccounts(script);
    
    clickExistingUser();
    
    break;
    
    
    
    case 1:
    
    Main.state = "Clicking Canceling";
    
    clickCancel();
    
    break;
    
    
    
    case 2:
    
    
    
    if (isAccountLocked()) {
    
    Main.state = "Locked";
    
    script.log(username + " is locked");
    
    appendToFileLocks();
    
    isTrue = true;
    
    Main.startTime2 = System.currentTimeMillis();
    
    clickCancel();
    
    }
    
    
    
    if (isAccountDisabled()) {
    
    Main.state = "Disabled";
    
    script.log(username + " is disabled");
    
    clickCancel();
    
    }
    
    
    
    if (isNonMember()) {
    
    Main.state = "Account is non-member.. stopping script";
    
    script.stop();
    
    }
    
    
    
    if (rsUpdated()) {
    
    Main.state = "RS update";
    
    script.log("RS Update");
    
    script.stop();
    
    }
    
    
    
    if (!isConnecting() && !isAccountDisabled()) {
    
    Main.state = "Entering account details";
    
    enterUserName();
    
    enterPassword();
    
    }
    
    break;
    
    case 3:
    
    if (isPasswordWrong()) {
    
    Main.state = "Wrong password";
    
    handleWrongPassword();
    
    }
    
    break;
    
    case 5:
    
    if (forgotPasswordScreen()) {
    
    Main.state = "Clicked forgot password";
    
    clickBack();
    
    }
    
    }
    
    }
    
    }
    [/code]
    

     

    You can look up how to read a text file, and find plenty of results on stack overflow.

     

    this really needs to be in a code block it looks like cancer without

    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.