Jump to content

Taking a screenshot at connection lost


Hayase

Recommended Posts

...

@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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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