Hey guys im new here so bare with me. I currently have my script set up in tasks which rechecks every 7 secconds
public void onStart(){
tasks.add(new BasicTask(this));
tasks.add(new LetsAfk(this));
tasks.add(new HandleBank(this));
tasks.add(new HandleLobby(this));
}
@Override
public int onLoop() throws InterruptedException {
tasks.forEach(Task::run);
return 7000;
}
From what i understand the way tasks work is it checks for a task every 7 seconds and once it finds a one that is valid it will run that until its not. One of my tasks works that if its in a certain position to start a afk timer and then move the mouse in a random interval from 1 second to like 4 mins and then repeat. My issue is tho even though the task is being activated and running the correct code for that task it is still getting refreshed every 7 seconds completely overriding the longer afk timer.
@Override
public boolean canProcess() {
return api.myPosition().equals(AFK_POS_Z);
}
public int waitTime(int min, int max) {
return (int)(Math.random() * (max - min)) + min;
}
@Override
public int process() {
api.log("in AFK AREA");
String zamMessage = api.getWidgets().get(59, 17).getMessage().substring(10);
api.log(zamMessage);
//int zamMessageInt = Integer.parseInt(zamMessage);
//api.log(zamMessageInt);
String saraMessage = api.getWidgets().get(59, 18).getMessage().substring(0,1);
api.log(saraMessage);
int saraMessageInt = Integer.parseInt(zamMessage);
api.log(saraMessageInt);
if (api.mouse.isOnScreen()) {
api.mouse.moveOutsideScreen();
} else {
api.mouse.move((int) (100 + (Math.random() * 660)), (int) (100 + (Math.random() * 400)));
}
return waitTime(1000, 260000);//(int) (Math.random() * 1000));
}
}