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.

Interaction gives NullPointerException?

Featured Replies

Why is my log giving this error? I made some changes, so it only has like a ~2 second delay to continue its action now, but its still kinda annoying. I saw that it provided more info about true or false and null methods, but I don't quite understand how that's relevant

Logger:

https://gyazo.com/bfd0d678cf7449a15894023b594844d3

Snippet of script:

https://gyazo.com/d16de96eb83d637888a0fc5e6e8cebfc

 

23 minutes ago, Dab in a Lab said:

Why is my log giving this error? I made some changes, so it only has like a ~2 second delay to continue its action now, but its still kinda annoying. I saw that it provided more info about true or false and null methods, but I don't quite understand how that's relevant

Logger:

https://gyazo.com/bfd0d678cf7449a15894023b594844d3

Snippet of script:

https://gyazo.com/d16de96eb83d637888a0fc5e6e8cebfc

 

X7uYWwD.png

*Correction fixed

brackets apply to  both if statements

25 minutes ago, Dab in a Lab said:

Why is my log giving this error? I made some changes, so it only has like a ~2 second delay to continue its action now, but its still kinda annoying. I saw that it provided more info about true or false and null methods, but I don't quite understand how that's relevant

Logger:

https://gyazo.com/bfd0d678cf7449a15894023b594844d3

Snippet of script:

https://gyazo.com/d16de96eb83d637888a0fc5e6e8cebfc

 

if (condition)
   statement1;
   statement2; 
//statement2 is not part of the if statement, but it looks like it because of wrong indentation
  • Author
6 minutes ago, Chris said:

X7uYWwD.png

*Correction fixed

brackets apply to  both if statements


if (condition)
   statement1;
   statement2; 
//statement2 is not part of the if statement, but it looks like it because of wrong indentation

Thank you! I kinda just assumed the null check would skip any log statements. If I were to get rid of the log under the null check, that would have fixed the issue too right?

8 minutes ago, Dab in a Lab said:

Thank you! I kinda just assumed the null check would skip any log statements. If I were to get rid of the log under the null check, that would have fixed the issue too right?

No. Log is for log check/ error checking. You need to make use of curly braces.

  • Author

@Chris I added the brackets but the script seems to skip over that snippet and run through the rest of the code. Then loops back and performs the action. Could that be because of how the rest of my script is written?

Edited by Dab in a Lab

4 minutes ago, Dab in a Lab said:

@Chris I added the brackets but the script seems to skip over that snippet and run through the rest of the code. Then loops back and performs the action. Could that be because of how the rest of my script is written?

First you need to understand that the code runs continuously and sometimes it skips certain parts, hence this where I will make use of conditional sleep.

  • Author
3 minutes ago, Charlotte said:

Don't see it for interaction, which is what you said was skipped. Curly braces still not used.

I added brackets to where Chris said, but the interaction is still a NullPointException. The place the brackets seemed to work was where I had them in the previous picture

https://gyazo.com/e41c968d49aafb68f7ee3d4694e07f04

And I have the conditional sleep return if the widget I'm interacting with exists. Should I instead have it return the interaction?

2 minutes ago, Dab in a Lab said:

I added brackets to where Chris said, but the interaction is still a NullPointException. The place the brackets seemed to work was where I had them in the previous picture

https://gyazo.com/e41c968d49aafb68f7ee3d4694e07f04

And I have the conditional sleep return if the widget I'm interacting with exists. Should I instead have it return the interaction?

Wrong use of curly braces.

if (T_AREA.contains(myPlayer())) {
	NPC t = getNpcs().closest("Ellis");
	if (t != null) {
		t.interact("Trade");
	}
}

 

  • Author
7 minutes ago, Charlotte said:

Wrong use of curly braces.


if (T_AREA.contains(myPlayer())) {
	NPC t = getNpcs().closest("Ellis");
	if (t != null) {
		t.interact("Trade");
	}
}

 

Ahhhh, ok. Thank you!

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.