Butters Posted December 16, 2016 Share Posted December 16, 2016 What's the best way to definitely know if you are logged in? client.isLoggedIn() ^ This returns true as soon as I get to the welcome screen (or even sooner). Even after pressing "Play" on the welcome screen there's a delay where it loads the maps or something. The problem I get is that I get tons of null pointer exceptions and this skips at least one tick of my loop. Also, when world hopping I believe that you get logged out for a little while (correct me if I'm wrong) and this launches my login event handler, which of course spouts out a ton of errors. By the way, after logging in I use worlds.getCurrentWorld() to check if I'm on the world I need to be, and when I do worlds.hop() the previous method gives me nullPointers. I do understand that when hopping there's some time when you are not in a world, but would like to handle or even evade these errors. Maybe use LoginStages? http://osbot.org/api/org/osbot/rs07/api/Client.LoginStage.html or maybe use LoginStates? http://osbot.org/api/org/osbot/rs07/api/Client.LoginState.html If so, which combination of these two would let me know that I can do script specific stuff (logged in and ready to go), like open a bank booth. Quote Link to comment Share on other sites More sharing options...
Xerifos Posted December 16, 2016 Share Posted December 16, 2016 I think you can even throw a simple if(myPlayer().isVisible) where myPlayser().isVisible is a boolean. Quote Link to comment Share on other sites More sharing options...
Butters Posted December 16, 2016 Author Share Posted December 16, 2016 I think you can even throw a simple if(myPlayer().isVisible) where myPlayser().isVisible is a boolean. Great idea! Will test it Quote Link to comment Share on other sites More sharing options...
Xerifos Posted December 16, 2016 Share Posted December 16, 2016 Great idea! Will test it Let me know if it worked :xdoge: Quote Link to comment Share on other sites More sharing options...
Vilius Posted December 16, 2016 Share Posted December 16, 2016 if(getClient().getLoginStateValue() == 30) //either if(getClient().getLoginState().equals(Client.LoginState.LOGGED_IN)) Havent tested that though, wrote from my phone too. 1 Quote Link to comment Share on other sites More sharing options...
Butters Posted December 16, 2016 Author Share Posted December 16, 2016 if(getClient().getLoginStateValue() == 30) //either if(getClient().getLoginState().equals(Client.LoginState.LOGGED_IN)) Havent tested that though, wrote from my phone too. Thanks. How do to check what the "30" in getLoginStateValue() stands for? And isn't this if(getClient().getLoginState().equals(Client.LoginState.LOGGED_IN)) the same as client.isLoggedIn() ? Quote Link to comment Share on other sites More sharing options...
Vilius Posted December 16, 2016 Share Posted December 16, 2016 Thanks. How do to check what the "30" in getLoginStateValue() stands for? And isn't this if(getClient().getLoginState().equals(Client.LoginState.LOGGED_IN))the same as client.isLoggedIn() ?1. The api tells you what those numbers stand for10 = Logged out 20 = Loading please wait... 30 = Logged in 2. The client.isLoggedIn() returns true even if its loading. From what I saw you wanted a check for when everything is loaded, not loading. Please read the API docs next time :xfeels: 2 Quote Link to comment Share on other sites More sharing options...
Butters Posted December 16, 2016 Author Share Posted December 16, 2016 1. The api tells you what those numbers stand for 10 = Logged out 20 = Loading please wait... 30 = Logged in 2. The client.isLoggedIn() returns true even if its loading. From what I saw you wanted a check for when everything is loaded, not loading. Please read the API docs next time Damn, thanks and sorry. Slipped through my eyes. Quote Link to comment Share on other sites More sharing options...