Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

ResponseCode usage

Featured Replies

  • Author
35 minutes ago, Lemons said:

So your mistake is thinking ResponseCode.isDisabledError knows the response code. It does not, it only checks the given response code (and your always giving 4 and 18, so its always true on any response code). Simple misunderstanding, those have bit all of us in the ass at some point.

 

That makes perfect sense. Thanks again for your help.

5 minutes ago, sudoinit6 said:

That makes perfect sense. Thanks again for your help.

No problem, you can always add me on skype or discord (handles in profile) if you want to shoot questions at me. Always willing to help someone who is willing to learn :)

  • Author

With lemon's help I found a way to make it work without a custom login handler, at least well enough to suit my needs here is what I did:

Spoiler

@Override
    public
     void onResponseCode(int responseCode)
            throws InterruptedException {
        if (ResponseCode.isDisabledError(responseCode)) {
        
            log("Account locked");
            try {
                log("trying to create text file.");
                PrintWriter writer = new PrintWriter(
                        
                        "/root/OSBot/Data/lockedAccounts.txt",
                        "UTF-8");
                writer.println("FIGJAM");
                writer.close();
            } catch (IOException e) {
                log("creating text file failed");
                // TODO Auto-generated catch block
                e.printStackTrace();
                System.exit(0);

            }
            System.exit(0);
        }if (ResponseCode.isConnectionError(responseCode)){
            log("login failed");
            try {
                log("trying to create text file.");
                PrintWriter writer = new PrintWriter(
                        
                        "/root/OSBot/Data/failedLogin.txt",
                        "UTF-8");
                writer.println("FIGJAM");
                writer.close();
            } catch (IOException e) {
                log("creating text file failed");
                // TODO Auto-generated catch block
                e.printStackTrace();
                System.exit(0);
        }
            
    }
}
}

What this does is write one file if the error type is disable error but a different file if it is a connection error (although I don't really need to write the second file).

 

Before it was executing my code on any error because I was passing thorough something that would always match. With this code it checks to see what kind of code it is, if it isn't a disabled code, it doesn't execute my instructions in the first section (which include an exit) and moves to the second. Since the second doesn't include an exit, the default login handler handles it like a normal connection error and waits 17 seconds to try again. Hopefully someone else can find use out of this.

 

Thanks Alek and lemons!

Edited by sudoinit6

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.