Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Knowing when you are logged in

Featured Replies

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.

I think you can even throw a simple if(myPlayer().isVisible) where myPlayser().isVisible is a boolean.               

  • Author

I think you can even throw a simple if(myPlayer().isVisible) where myPlayser().isVisible is a boolean.               

 

Great idea! Will test it 

Great idea! Will test it 

Let me know if it worked :xdoge:

if(getClient().getLoginStateValue() == 30)
//either
if(getClient().getLoginState().equals(Client.LoginState.LOGGED_IN))

Havent tested that though, wrote from my phone too.

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

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:

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

 

Damn, thanks and sorry. Slipped through my eyes.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.