Jump to content

Learning to script with Intellij help?


obrands

Recommended Posts

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🙉

Link to comment
Share on other sites

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");
    }

Link to comment
Share on other sites

@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

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...