Jump to content

How to detect finished to connecting to update server?


Pegasus

Recommended Posts

 

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

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?

 

Link to comment
Share on other sites

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.

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