Pegasus Posted February 26, 2019 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
HunterRS Posted February 26, 2019 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
Pegasus Posted February 26, 2019 Author 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?
HunterRS Posted February 26, 2019 Posted February 26, 2019 Pretty sure I just tested them out by logging them. Might be documented someplace though.
luciuspragg Posted February 26, 2019 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.