Jump to content

Taking a screenshot at connection lost


Recommended Posts

Posted
...

@Override
public void onPaint(Graphics2D g) {

...

    /*
     * If the bot loses connection (got banned?)--take a screenshot
     */
    if (getClient().getLoginStateValue() == 40) {//40 = connection lost
        log("Client connection lost!");
        Utilities.takeScreenshot();
    }
    
...

Detecting the last moments of your bot! I've always wondered when and where my bot would get banned. It would be nice to see the last bit of life the bot had before it got banned.

This snippet does generate false positives because not all connection losts are bans.

 

1485705093.png

 

The only problem is if you run a lot of bots and are having connection issues--this could potentially generate a lot of disk space.

  • Like 1
Posted
On 1/29/2017 at 8:17 AM, Token said:

You can eliminate the real dc's by checking the login response code you will get immediately after, 4 is for banned, just delete the screenshot you took otherwise since they are in the data folder and you have access to them from within your scripts

Oh nice I didn't think of deleting. I'll fix it up :3

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...