December 16, 20169 yr 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.
December 16, 20169 yr I think you can even throw a simple if(myPlayer().isVisible) where myPlayser().isVisible is a boolean.
December 16, 20169 yr Author I think you can even throw a simple if(myPlayer().isVisible) where myPlayser().isVisible is a boolean. Great idea! Will test it
December 16, 20169 yr if(getClient().getLoginStateValue() == 30) //either if(getClient().getLoginState().equals(Client.LoginState.LOGGED_IN)) Havent tested that though, wrote from my phone too.
December 16, 20169 yr Author 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() ?
December 16, 20169 yr 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:
December 16, 20169 yr Author 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.
Create an account or sign in to comment