kingwill Posted November 20, 2015 Share Posted November 20, 2015 (edited) 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){ } } Edited November 20, 2015 by kingwill Quote Link to comment Share on other sites More sharing options...
Explv Posted November 20, 2015 Share Posted November 20, 2015 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. 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){ } } Try deleting the OSBot folder, restarting OSBot, and then re-building your script. 1 Quote Link to comment Share on other sites More sharing options...
kingwill Posted November 20, 2015 Author Share Posted November 20, 2015 Will try now, should that code work? Ok I have done that and it is still not appearing. Quote Link to comment Share on other sites More sharing options...
Explv Posted November 21, 2015 Share Posted November 21, 2015 Problem was he had some other files in his .jar other than 'compiled output' . 1 Quote Link to comment Share on other sites More sharing options...
felane Posted November 22, 2015 Share Posted November 22, 2015 im having the same issue! i deleted my osbot found in my c that has my data with the script folder.. I pasted a couple of my old scripts in there and they never show up in the please select which script to use. i refresh and nothing.. Idk whats wrong i like my scripts! Quote Link to comment Share on other sites More sharing options...