So I have a couple things I did on my scripts that seemed to do well for me. I'm on a bit of a hiatus, just kind of lurking the forums.
I had one function I'd run after every action to check if it should be taking a break or not and if it's a quick break (5-35 sec) or a long break (45 sec - 5 min).
It takes an input and the higher the int the less likely the break will trigger. So use lower numbers for tasks that click less like fishing, and higher numbers for click intensive stuff like thieving.
public int breakRoll(int BreakChance){
int restChance = random(1, BreakChance);
int longRestChance = random(1,BreakChance / 2);
int longRest = random(45_000, 300_000);
int shortRest = random(5_000, 30_000);
if(restChance == BreakChance){
if(longRestChance == BreakChance / 2){
log("Long resting for " + longRest);
return longRest;
} else {
log("Short resting for " + shortRest);
return shortRest;
}
} else {
return 1_500;
}
}
Also, if I'm dropping an inventory of stuff I try not to use the drop functions out of the API, I use a function that drops in random patterns. This one will drop a whole inventory, but you can remove inventory slots from the dropPattern arrays and those inventory slots will not be dropped, but I've only ever used this for dropping stuff from thieving stalls and cleaning herbs (requires removing a couple lines of code)
void dropInventory() throws InterruptedException {
if(tabs.getOpen().equals(Tab.INVENTORY)) {
int[] dropPattern1 = {0, 1, 2, 3, 7, 6, 5, 4, 8, 9, 10, 11, 15, 14, 13, 12, 16, 17, 18, 19, 23, 22, 21, 20, 24, 25, 26, 27};
int[] dropPattern2 = {0, 4, 8, 12, 16, 20, 24, 25, 21, 17, 13, 9, 5, 1, 2, 6, 10, 14, 18, 22, 26, 27, 23, 19, 15, 11, 7, 3};
int[] dropPattern3 = {0, 4, 8, 12, 16, 20, 24, 25, 26, 27, 23, 19, 15, 11, 7, 3, 2, 1, 5, 9, 13, 17, 21, 22, 18, 14, 10, 6};
int[] dropPattern4 = {0, 1, 2, 3, 7, 11, 15, 19, 23, 27, 26, 25, 24, 20, 16, 12, 8, 4, 5, 6, 10, 14, 18, 22, 21, 17, 13, 9};
int[] myPattern = {0};
switch (random(1, 4)) {
case 1:
log("pattern 1");
myPattern = dropPattern1;
break;
case 2:
log("pattern 2");
myPattern = dropPattern2;
break;
case 3:
log("pattern 3");
myPattern = dropPattern3;
break;
case 4:
log("pattern 4");
myPattern = dropPattern4;
break;
}
if (myPattern.length > 1) {
keyboard.pressKey(16);
for (int i = 0; i < myPattern.length; i++) {
getMouse().click(getInventory().getMouseDestination(myPattern[i]));
}
keyboard.releaseKey(16);
sleep(1_000);
} else {
log("Unable to set pattern");
}
} else {
tabs.open(Tab.INVENTORY);
}
}
To change it up from dropping items to clicking items for things like cleaning herbs, remove the 2 lines that say
keyboard.pressKey(16);
keyboard.releaseKey(16);
Key(16) is shift.