I've been having some trouble with widgets lately, can't seem to make it detect whether a widget is visible or not properly.
So I currently have this Task assigned. It can't seem to be able to validate when the widget appears. I noticed it detects the widget right when I stop the script, and if I restart the script without refreshing the script selection window, it detects the widget, but not able to execute the method.
Code:
/**
* Created by Viston on 11/07/2017.
*/
public class InsideDreamWalkToMid extends Task {
public InsideDreamWalkToMid(MethodProvider s) {
super(s);
}
@Override
public boolean canProcess() {
RS2Widget inDreamWidget;
inDreamWidget = s.getWidgets().singleFilter(s.getWidgets().getAll(), widget -> widget != null && widget.getMessage().contains("Points:"));
return inDreamWidget != null && inDreamWidget.isVisible();
}
@Override
public void process() throws InterruptedException {
Paint.status = "Inside...";
Vars.middleTile = s.myPosition().translate(10, 15);
s.getWalking().walk(Vars.middleTile))
}
}
--------------------------------------------------------------------------------------------------------------------------------------------------------------
A gif of my explanation above > http://i.imgur.com/NXu1zM2.gifv
As you can see, if I refresh before starting the script, it's not able to detect the widget. However, just when I stop the script, the Paint.status = "Inside..."; appears, which means it successfully validated the task.
If I start the script without refreshing, it's able to detect the widget, yet not able to execute the method.