Hi I am new here and trying to build my own experiments script.
When I build the jar file into the /OSBot/Scripts folder and run OSBot it does not come up in the client.
However, when the client is open and I try to delete the jar from the folder it says I cannot because it is in use.
I have copy and pasted the code to a new file but it still does not appear.
I am using IntelliJ to create my jar, and when I select the main class it says 'not available' but still allows me to build and reports it as successful.
The reason I have coded the script like this is because all AIO fighters still click the level 52 experiment, that is why I have based it on IDs not npc name, so if you think there may be issues further down the line due to this please let me know.
Cheers
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import java.awt.*;
import javax.swing.*;
@ScriptManifest(author = "The man", info = "Experimental experiment killer", name = "Experimental experiment killer", version = 0.1, logo = "")
public class ExperimentKilla extends Script {
public static String status;
@Override
public void onStart() {
JOptionPane.showMessageDialog(null, "Welcome to my first script hello world");
}
private enum State {
ATTACK1, ATTACK2, WAIT
}
private State getState(){
NPC experiment1 = npcs.closest(1274);
NPC experiment2 = npcs.closest(1275);
if (experiment1 != null){
return State.ATTACK2;
}
if (experiment2 != null){
return State.ATTACK1;
}
return State.WAIT;
}
@Override
public int onLoop() throws InterruptedException {
switch(getState()){
case ATTACK1:
NPC experiment1 = npcs.closest(1274);
if (experiment1 != null && !combat.isFighting() && !experiment1.isUnderAttack() && experiment1.isAttackable()) {
experiment1.interact("Attack");
status = "Attacking experiment 1";
sleep(random(200,800));
}
break;
case ATTACK2:
NPC experiment2 = npcs.closest(1275);
if (experiment2 != null && !combat.isFighting() && !experiment2.isUnderAttack() && experiment2.isAttackable()){
experiment2.interact("Attack");
status = "Attacking experiment 2";
sleep(random(200,800));
}
break;
case WAIT:
sleep(random(299, 643));
break;
}
return random(100,540);
}
@Override
public void onExit(){
JOptionPane.showMessageDialog(null, "Thanks for using.");
}
@Override
public void onPaint(Graphics2D g){
}
}