i already had it imported. This is my code for the COOK state:
case COOK:
Entity fire = objects.closest("fire");
inventory.interact("Use", "Trout");
fire.interact("Use");
if (getWidget.isVisible(307,2)) {
getWidgets().interact(307,2 "Cooked All");
}
break;
getWidget, interact, and "Cooked all" both have red lines.
It is supposed to recognize the fire, select the trout, right click and click use on the fire, see if the widget is available, then select cook all.
I fixed the code.
RS2Widget cookMenu = widgets.get(307,4);
if(cookMenu != null && cookMenu.isVisible())
cookMenu.interact("Cook All");
I compiled it, and it does nothing. Here's my code:
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.ui.RS2Widget;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import java.awt.*;
@ScriptManifest(author = "You", info = "My first script", name = "Tea thiever", version = 0, logo = "")
public class main extends Script {
@Override
public void onStart() {
log("Let's get started!");
}
private enum State {
FISH, COOK, DROP
};
private State getState() {
if(inventory.isEmptyExcept(310, 17794, 309, 17795, 123, 17796))
return State.FISH;
if(inventory.isFull())
return State.COOK;
return State.DROP;
}
@Override
public int onLoop() throws InterruptedException {
switch(getState()){
case FISH:
Entity fishingSpot = objects.closest("Fishing Spot");
fishingSpot.interact("Lure");
break;
case COOK:
Entity fire = objects.closest("fire");
inventory.interact("Use", "Trout");
fire.interact("Use");
RS2Widget cookMenu = widgets.get(307,4);
if(cookMenu != null && cookMenu.isVisible())
cookMenu.interact("Cook All");
break;
case DROP:
inventory.dropAll(331, 332, 333, 334, 25976);
break;
}
return random(200, 300);
}
@Override
public void onExit() {
log("Thanks for running my first script!");
}
@Override
public void onPaint(Graphics2D g) {
}
}