Just a cool concept that I had thought of that may come in handy for people attempting to do large projects. This is relatively beginner Java but I thought I'd share because I found it to be somewhat interesting when I thought of the idea.
Below is a snippet of code of the Main Script subclass with the @ScriptManifest annotation and a TestScript class. You should only ever use the annotation once in the Main class. You can set the runnable script either with a GUI or CLI args. This concept would enable large projects sorted by packages that contain multiple different scripts to be accessed this way in the same script. I would consider doing something like this for an Ironman kind of script that did a lot of different activities.
package core;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import java.awt.*;
@ScriptManifest(version = 0.0, logo = "", info = "", name = "Ironman", author = "Malcolm")
public class Main extends Script {
private Script runnableScript;
public void onStart() throws InterruptedException {
this.runnableScript = new TestScript();
this.runnableScript.exchangeContext(getBot());
this.runnableScript.onStart();
}
@Override
public int onLoop() throws InterruptedException {
return this.runnableScript.onLoop();
}
public void onExit() throws InterruptedException {
this.runnableScript.onExit();
}
public void onPaint(Graphics2D g) {
this.runnableScript.onPaint(g);
}
}
package core;
import org.osbot.rs07.script.Script;
import java.awt.*;
public class TestScript extends Script {
private Paint paint;
@Override
public void onStart() {
this.paint = new Paint(this);
log("Test Script onStart");
}
@Override
public void onExit() {
log("Test Script onExit");
}
@Override
public int onLoop() throws InterruptedException {
log("RUNNING TEST SCRIPT");
return 100;
}
@Override
public void onPaint(Graphics2D g) {
this.paint.paint(g);
}
}