Jump to content

Knowing when you are logged in


Butters

Recommended Posts

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.

Link to comment
Share on other sites

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() ?

Link to comment
Share on other sites

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 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 :xfeels:

  • Like 2
Link to comment
Share on other sites

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

 

Damn, thanks and sorry. Slipped through my eyes.

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