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.

NullPointer on condition sleep

Featured Replies

so I have this code:

		case ALCH:
			if(getMagic().canCast(NormalSpells.HIGH_LEVEL_ALCHEMY)){
				if(!myPlayer().isAnimating()){
					if(getMagic().castSpell(NormalSpells.HIGH_LEVEL_ALCHEMY)){
						status = "Alching";
						if(getInventory().interact("Cast", "Maple longbow")){
							new ConditionalSleep(3000) {
								@Override
								public boolean condition() {
									return myPlayer().isAnimating();
								}
							}.sleep();
						}
					}
				}
			}
			break;

 

?and I am geting a freaking NPE on declarin the ConditionalSleep, any idea why

why not just do

 

sleep(random(2800, 3200));

 

or something?

why not just do

 

sleep(random(2800, 3200));

 

or something?

18 minutes ago, Quotations said:

why not just do

 

sleep(random(2800, 3200));

 

or something?

why not just do

 

sleep(random(2800, 3200));

 

or something?

because thats unreliable.

@HunterRS you can use Explv's sleep class here: https://hastebin.com/izebukinep.java (drop it under your main class) and use 

Sleep.sleepUntil(() -> !myPlayer().isAnimating(), 3000);

as an alternative to using ConditionalSleep, it makes the code more readable imo

 

51 minutes ago, Quotations said:

why not just do

 

sleep(random(2800, 3200));

 

or something?

why not just do

 

sleep(random(2800, 3200));

 

or something?

Please don't troll here, we have a SPAM section for troll posts.

 

28 minutes ago, 3qTQlBnsOsyfetvA said:

because thats unreliable.

@HunterRS you can use Explv's sleep class here: https://hastebin.com/izebukinep.java (drop it under your main class) and use 


Sleep.sleepUntil(() -> !myPlayer().isAnimating(), 3000);

as an alternative to using ConditionalSleep, it makes the code more readable imo

 

Not sure how that solves his problem. Conditional sleeping is working on other scripts, so it must be something wrong. 

 

@HunterRS Post the stack trace/error

  • Author
46 minutes ago, Alek said:

Please don't troll here, we have a SPAM section for troll posts.

 

Not sure how that solves his problem. Conditional sleeping is working on other scripts, so it must be something wrong. 

 

@HunterRS Post the stack trace/error

Error in script executor!
java.lang.NullPointerException
    at Main.onLoop(Main.java:385)
    at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(xe:49)
    at java.lang.Thread.run(Unknown Source).

 

 

EDIT: it is no longer in the condition sleep
Line 385:

if(getMagic().castSpell(NormalSpells.HIGH_LEVEL_ALCHEMY)){

 

Edited by HunterRS

if(getInventory().interact("Cast", "Maple longbow")){

 

I may not know what I am talking about but this looks odd to me. Is interact a boolean? How do you "if" an interact? Or does that me if I am currently interacting with cast and the target is maple longbow?

 

 

  • Author
6 hours ago, sudoinit6 said:

if(getInventory().interact("Cast", "Maple longbow")){

 

I may not know what I am talking about but this looks odd to me. Is interact a boolean? How do you "if" an interact? Or does that me if I am currently interacting with cast and the target is maple longbow?

 

 

http://prntscr.com/goke1u

Is it spamming null pointer a lot? If so you have to stop the script instantly and scroll all the way up to the original stack trace, which is what I suspect is happening.

  • Author
4 hours ago, Alek said:

Is it spamming null pointer a lot? If so you have to stop the script instantly and scroll all the way up to the original stack trace, which is what I suspect is happening.

Nope, I know what you mean and it isn't doing that....

Gives the error once every couple of seconds

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.