I thought I'd give scripting a try so that I may provide others in the community with working scripts, but I can't even get my first prototype working. I got this in the terminal:
[ERROR][10/24 10:32:34 AM]: Failed to start script [zWoodcutter]
java.lang.InstantiationException
at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.osbot.com2.run(yn:198)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
What does this mean? How do I solve it? Here's my code:
package Woodcutter;
import java.awt.Graphics2D;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.api.model.Entity;
@ScriptManifest(author = "Zulfe", info = "Chops Yews at Edgeville", logo = "N/A", name = "zWoodcutter", version = 1.0)
public abstract class Woodcutter extends Script {
//code to be executed at the start of script
@Override
public void onStart(){
log("Starting de script");
}
private enum State {
CHOP, BANK, WAIT;
};
private State getState() {
if(!(inventory.isFull()))
return State.CHOP;
if(inventory.isFull())
return State.BANK;
return State.WAIT;
}
@Override
public int onLoop() throws InterruptedException{
switch (getState()) {
case CHOP:
Entity willowTree = objects.closest("Tree");
if (willowTree != null)
willowTree.interact("Chop down");
break;
case BANK:
if (inventory.isFull()){
inventory.dropAll();
}
break;
case WAIT:
sleep(random(500, 700));
break;
}
return 50;
}
//code to be executed at the end
@Override
public void onExit(){
}
@Override
public void onPaint(Graphics2D g){
}
}