Im trying to get my script to walk from location1 to location2 and on the way to location2 there is a door that needs to be opened once opened i want to use a item in my inventory on a object but the problem im having is on the way there when i get to the door script tries to use my inventory item on object even though door is closed, but sometimes rarely will open door then use item on object, posted code below kinda-iffy just really tired atm.
if(!UI.cookingArea.contains(myPlayer())) {
setStatus("Walking to range/fire.");
getWalking().webWalk(UI.cookingArea);
if(getDoorHandler().handleNextObstacle(UI.cookingArea)) {
new ConditionalSleep(5000) {
@Override
public boolean condition() throws InterruptedException {
return getMap().canReach(range);
}
}.sleep();
}
}
if (!getWidgets().isVisible(270, 14)) {
setStatus("Using food on range/fire.");
getInventory().interact("Use", UI.foodType);
if (range.interact("Use")) {
new ConditionalSleep(2000) {
@Override
public boolean condition() throws InterruptedException {
return getWidgets().isVisible(270, 14);
}
}.sleep();
}
}
else {
if (getWidgets().interact(270, 14, "Cook")) {
setStatus("Cooking food.");
new ConditionalSleep(100_000) {
@Override
public boolean condition() throws InterruptedException {
return !inventory.contains("Raw") || getDialogues().isPendingContinuation();
}
}.sleep();
if(getDialogues().isPendingContinuation()) {
getDialogues().clickContinue();
}
}
}