Jump to content

How to detect finished to connecting to update server?


Recommended Posts

Posted (edited)

 

I use Tasks in my code so verify is essentially how I check if I should attempt to log in

 

@Override
    public boolean verify() {
        return getLobbyButton() != null || !isLoggedIn();
    }

private RS2Widget getLobbyButton() {

        RS2Widget button = null;
        try {
            button = script.getWidgets().getWidgetContainingText("CLICK HERE TO PLAY");
        }
        catch (NullPointerException e) {
            script.log(e);
        }
        return button;
    }

public boolean isLoggedIn() {
        return isHopping() ||
                script.getClient().getLoginStateValue() == 30 ||
                script.getClient().isLoggedIn();
    }
 public boolean isHopping() {
        return script.getClient().getLoginStateValue() == 45 ||
                script.getClient().getLoginStateValue() == 25;
    }
 
Edited by HunterRS
  • Like 1
Posted
14 minutes ago, HunterRS said:

 

I use Tasks in my code so verify is essentially how I check if I should attempt to log in

 


@Override
    public boolean verify() {
        return getLobbyButton() != null || !isLoggedIn();
    }

private RS2Widget getLobbyButton() {

        RS2Widget button = null;
        try {
            button = script.getWidgets().getWidgetContainingText("CLICK HERE TO PLAY");
        }
        catch (NullPointerException e) {
            script.log(e);
        }
        return button;
    }

public boolean isLoggedIn() {
        return isHopping() ||
                script.getClient().getLoginStateValue() == 30 ||
                script.getClient().isLoggedIn();
    }
 public boolean isHopping() {
        return script.getClient().getLoginStateValue() == 45 ||
                script.getClient().getLoginStateValue() == 25;
    }
 

Thanks.<3

It works.

How do you know what do the values of getLoginStateValue() represent?

 

Posted
12 hours ago, Pegasus said:

Thanks.<3

It works.

How do you know what do the values of getLoginStateValue() represent?

 

https://osbot.org/api/org/osbot/rs07/api/Client.html#getLoginStateValue-- has the following values:

Quote

10 = Logged out 20 = Loading please wait... 30 = Logged in

However @HunterRS's code suggests that there's more you'd be able to find by testing.

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