mark jacobs Posted October 13, 2020 Posted October 13, 2020 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!
Khaleesi Posted October 13, 2020 Posted October 13, 2020 (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 October 13, 2020 by Khaleesi