Sooo.... I've spent a while away from making scripts but since I finally have time to work on some stuff, I've decided to make a simple motherload miner
The code is mostly done and I'm planning to release it at some point, but I only have one problem....
RS2Object oreDeposit = api.getObjects().closest("Ore vein");
String objectName = oreDeposit.getName();
int objectModelID = oreDeposit.getId();
if(api.getMap().canReach(oreDeposit)) {
oreDeposit.interact("Mine");
api.log("Waiting to be done mining");
new ConditionalSleep(6000, 8000) {
@Override
public boolean condition() {
return !api.getObjects().closest(objectModelID).getName().equals("Ore vein");
}
}.sleep();
I've made this simple conditional sleep, which checks the model ID of the previously saved object, and compares it to what it expected to be there while the ore is mineable,
All is good while it is still called 'ore vein', but after it depletes, it starts freaking out (I have to force close it) with a NullPointerException
I've checked the modeID before and after it has depleted, and it does not change, therefore I am here to see what you guys suggest! Or I accept being absolutely retarded (it do be like that sometimes)