Jump to content

Loot task


Recommended Posts

Posted

Wanted to ask a question about my loot class. I'm fairly new to script writing and when I created this loot task, and add it to my task list, it makes the entire bot really laggy compared to when I remove it from my task list. I'm guessing this is because im calling a really heavy method or something on my activate or execute? So far, this is what I'm using:
 

Quote

//activate


@Override
public boolean canProcess() throws InterruptedException {
    return script.getGroundItems().closest(GroundID).exists();
}

//execute


@Override
public void process() throws InterruptedException {
    script.currentState = Status.LOOTING;

    GroundItem loot = script.getGroundItems().closest(GroundID);

    if (GroundID != null && !script.getInventory().isFull()) {
        loot.interact("Take");
        sleep(random(999,1777));
    }
}

Any thoughts on why it literally makes my client feel as if i'm using a computer from 2002 because it's that laggy, lol?? 
Any advice appreciated!

Posted (edited)

 

2 hours ago, mark jacobs said:

Wanted to ask a question about my loot class. I'm fairly new to script writing and when I created this loot task, and add it to my task list, it makes the entire bot really laggy compared to when I remove it from my task list. I'm guessing this is because im calling a really heavy method or something on my activate or execute? So far, this is what I'm using:
 

Any thoughts on why it literally makes my client feel as if i'm using a computer from 2002 because it's that laggy, lol?? 
Any advice appreciated!

bcs it's probably giving you a nullpointer exception, if you call a method of an instance that doesn't exist this will happen :)
You have to check != null instead of .exists()

Edited by Khaleesi

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...