Hi Osbot,
My script is freezing when i try to start the cooks assistant quest. Why is this?
I have 3 classes: main, gui & cooksassistant. When i select cooks assistant in the gui and press start, the whole client freezes.
Main class:
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import java.awt.*;
@ScriptManifest(author = "Sebastian", info = "All F2P Quests", name = "SB Quester", version = 0, logo = "")
public class main extends Script {
public String quest = "";
Object lock = new Object();
private gui gui = new gui();
private cooksassistant cooksAssistant = new cooksassistant();
@Override
public void onStart() {
log("Starting script..");
gui.run(this);
}
private enum State {
COOKSASSISTANT, WAIT
};
private State getState() {
if (quest == "Cooks Assistant")
return State.COOKSASSISTANT;
return State.WAIT;
}
@Override
public int onLoop() throws InterruptedException {
switch (getState()) {
case COOKSASSISTANT:
cooksAssistant.run();
break;
case WAIT:
sleep(random(500, 700));
break;
}
return random(200, 300);
}
@Override
public void onExit() {
log("Goodbye");
}
@Override
public void onPaint(Graphics2D g) {
}
}
GUI:
JComboBox<String> questList = new JComboBox<String>(new String[] { "None", "Cooks Assistant"});
questList.addActionListener(e -> main.quest = (String) questList.getSelectedItem());
Cooksassistant class:
import org.osbot.rs07.script.MethodProvider;
public class cooksassistant extends MethodProvider {
public void run() {
log("Talking to Cook");
}
}
Does someone know what the problem is here?