Tasemu Posted May 23, 2017 Posted May 23, 2017 I've noticed when running OSBot in debug mode I am getting a lot of null pointer errors because my bot is not logged in yet and the world has not loaded. Is there a best practise method for holding the script until the world is correctly loaded in? Cheers!
Shudsy Posted May 23, 2017 Posted May 23, 2017 (edited) 9 minutes ago, Slut said: if(getClient().isLoggedIn()) This returns true during the "Loading please wait" message aswell, and items will still return null. Edited May 23, 2017 by Shudsy
Hel Posted May 23, 2017 Posted May 23, 2017 6 minutes ago, Shudsy said: This returns true during the "Loading please wait" message aswell, and items will still return null. I've never had an issue with this and I use it alongside ingame widgets that are only visible once things are loaded, but noted
Tasemu Posted May 23, 2017 Author Posted May 23, 2017 Any checks for world loaded? Maybe checking if the character is visible...? lol
Polymorphism Posted May 23, 2017 Posted May 23, 2017 widgets -> singleFilter -> parent 548 ->hasAction Look North Sorry in a rush can't write the code, check if that widget is visbile
Hayase Posted May 24, 2017 Posted May 24, 2017 I like to use player indexes on first startup if (getClient().getMyPlayerIndex() > 0) { //or whatever //..... }
Tasemu Posted May 24, 2017 Author Posted May 24, 2017 On 2017-5-23 at 10:06 AM, Shudsy said: This returns true during the "Loading please wait" message aswell, and items will still return null. public boolean isLoggedIn() Returns if you are currently logged in. Returns: True if logged in and not logged out or 'loading please wait...'. Is the api docs out of date? or is the description wrong?
Shudsy Posted May 24, 2017 Posted May 24, 2017 8 minutes ago, Tasemu said: public boolean isLoggedIn() Returns if you are currently logged in. Returns: True if logged in and not logged out or 'loading please wait...'. Is the api docs out of date? or is the description wrong? Not sure, but isLoggedIn() always bugs out for me when checking for items