Jump to content

Loot task


mark jacobs

Recommended Posts

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!

Link to comment
Share on other sites

 

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
Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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