Pegasus Posted February 26, 2019 Share Posted February 26, 2019 (edited) getBot().isLoaded() return true when is black screen appears. How to detect this when I use cli with -allow norandoms Edited February 26, 2019 by Pegasus Quote Link to comment Share on other sites More sharing options...
HunterRS Posted February 26, 2019 Share Posted February 26, 2019 (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 February 26, 2019 by HunterRS 1 Quote Link to comment Share on other sites More sharing options...
Pegasus Posted February 26, 2019 Author Share Posted February 26, 2019 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. It works. How do you know what do the values of getLoginStateValue() represent? Quote Link to comment Share on other sites More sharing options...
HunterRS Posted February 26, 2019 Share Posted February 26, 2019 Pretty sure I just tested them out by logging them. Might be documented someplace though. Quote Link to comment Share on other sites More sharing options...
luciuspragg Posted February 26, 2019 Share Posted February 26, 2019 12 hours ago, Pegasus said: Thanks. 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. Quote Link to comment Share on other sites More sharing options...