Jump to content

Why is this code lagging/crashing my script?

Recommended Posts

As soon as it collects the chaos rune, it starts lagging and giving null point exception errors. I have NO idea why. Can anyone shed some light please? :/

	public int onLoop() throws InterruptedException {

		GroundItem cRune = getGroundItems().closest("Chaos rune");

		if (cRune.isVisible() && cRune != null) {
			Sleep.sleepUntil(() -> !cRune.isVisible(), 1000);
		} else {
			sleep(random(500, 1500));
		return 700;


  • Like 1
Link to post
Share on other sites
7 minutes ago, Gunman said:

@Lol_marcus Try swapping the .isVisible() and null check around in the first if statement. And your sleep condition may also throw an NPE. If it does just change it out with !cRune.Exists()

Did both and it seems to have stabilized. Thanks for that. :)

  • Like 2
Link to post
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.

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