obrands Posted March 21, 2020 Share Posted March 21, 2020 Hi everyone. So im new to writing scripts and just want to try a script that i wrote quite fast. So i tried to make the script to a jar file by going to project structure/artifacts/new jar/empty and i choose the "compile output" file from avaliable elements and then applied the settings. After i build it, i get the jar file and when i start OSBOT i can't find it in the bot scripts... Then i downloaded a jar file from the forum and put it in the script folder, and when i start OSBOT i can see the downloaded JAR script but not my own script... if i check the logger, it says [INFO][03/21 03:37:41 em]: Started bot #1 [ERROR][03/21 03:37:43 em]: Failed to load local script : Main.class [ERROR][03/21 03:37:44 em]: Failed to load local script : Main.class [ERROR][03/21 03:37:44 em]: Failed to load local script : Main.class [ERROR][03/21 03:37:45 em]: Failed to load local script : Main.class .... maybe someone can guide me how to create jar file the right way or writing the script haha Quote Link to comment Share on other sites More sharing options...
Gunman Posted March 21, 2020 Share Posted March 21, 2020 @obrands Put code in pastebin and post here Quote Link to comment Share on other sites More sharing options...
obrands Posted March 21, 2020 Author Share Posted March 21, 2020 1 minute ago, Gunman said: @obrands Put code in pastebin and post here import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest( logo = "1", name = "testing", version = 1, author = "Obrands", info = "hi") public class Main extends Script { @Override public void onStart() { log("welcome"); } @Override public int onLoop() throws InterruptedException { NPC goblin = npcs.closest("goblin"); if (goblin != null) { goblin.interact("Attack"); } return random(1000, 2000); } @Override public void onExit() { log("bye"); } Quote Link to comment Share on other sites More sharing options...
Gunman Posted March 21, 2020 Share Posted March 21, 2020 @obrands Doesn't look like it's a script issue. If the jar is in the script folder and it's not showing up then it's something to do with the compile part. Look at this intellij setup and see if you did anything wrong. Only need to look at part 1 https://osbot.org/forum/topic/154399-script-development-setup/?tab=comments#comment-2011973 Quote Link to comment Share on other sites More sharing options...
obrands Posted March 21, 2020 Author Share Posted March 21, 2020 2 minutes ago, Gunman said: @obrands Doesn't look like it's a script issue. If the jar is in the script folder and it's not showing up then it's something to do with the compile part. Look at this intellij setup and see if you did anything wrong. Only need to look at part 1 https://osbot.org/forum/topic/154399-script-development-setup/?tab=comments#comment-2011973 Thanks, will check and reply if it works! Quote Link to comment Share on other sites More sharing options...
BravoTaco Posted March 21, 2020 Share Posted March 21, 2020 Make sure you are using JDK 8. Link: JDK 8 Quote Link to comment Share on other sites More sharing options...
ProjectPact Posted March 21, 2020 Share Posted March 21, 2020 Check this out! That script you wrote could be made in 10 seconds with this! It does all the work for you without the need for an IDE, knowledge of the API, or a background in Java! Quote Link to comment Share on other sites More sharing options...
obrands Posted March 21, 2020 Author Share Posted March 21, 2020 5 hours ago, Gunman said: @obrands Doesn't look like it's a script issue. If the jar is in the script folder and it's not showing up then it's something to do with the compile part. Look at this intellij setup and see if you did anything wrong. Only need to look at part 1 https://osbot.org/forum/topic/154399-script-development-setup/?tab=comments#comment-2011973 It worked like a charm! Also, i had downloaded the JDK 11 and JRE 8.. so i saw that i didnt have the JDK 8 which was my fault. Although, thanks alot! Cheers 1 Quote Link to comment Share on other sites More sharing options...