Jump to content

[TUTORIAL] Intellij Setup for Script Development


Recommended Posts

How to set up Intellij for Script Development

Please note that EpicBot uses Java 8. You can download this from Oracle here.

If your Java version is not 8, set up Intellij to use Java 8, read "Set Up Intellij" here.

Don't know your Java version? Type java --version in a command prompt. 

SETUP

Make a new Intellij Project

Go to File -> Project Structure -> Modules. Click the + icon. Select JARs or Directories.

ooXijxL.jpg

 

Find your EpicBot folder. Select the dependencies folder and click OK.

apE6omh.jpg

 

You should now see it in your Dependencies list. Click Apply (don't click OK).

5icxAHK.png

 

Click your Artifacts tab on the left, and the plus arrow again. Select "Other" from the drop down menu.

H06HbLT.jpg

 

You should see something like this:

B7TsG1A.png

 

Name your artifact at the top (must be unique from your other script artifact names in other projects).

Select the "Include in project build" checkbox.

Click the '<project name> compile output' on the right side, so it moves to the left column.

Click the file folder on the left.

F27ZuH3.jpg

 

Find your EpicBot/scripts folder. You may not have one, and will need to make one. Select it and click OK.

411RuFn.png

If your screen looks like this, click Apply and OK.

4BdNXKZ.png

Any script should now compile when you click the "Build Project" button (green hammer top right)

 

Making a Test Script

Right click your src folder on the left. Select New -> Java Class, and name it.

t5p2rKl.png

You should get something like this:

dVHromH.png

 

A quick sample script to test:

import com.epicbot.api.shared.APIContext;
import com.epicbot.api.shared.GameType;
import com.epicbot.api.shared.script.LoopScript;
import com.epicbot.api.shared.script.ScriptManifest;
import com.epicbot.api.shared.util.paint.frame.PaintFrame;

import java.awt.*;

@ScriptManifest(name = "Test Script", gameType = GameType.OS)
public class TestClass extends LoopScript {

    @Override
    public boolean onStart(String... strings) {
        return true;
    }

    @Override
    protected int loop() {
        return 50;
    }

    @Override
    protected void onPaint(Graphics2D g, APIContext ctx) {
        PaintFrame frame = new PaintFrame("Test Script");
        frame.addLine("Title", "Value");
        frame.draw(g, 0, 170, ctx);
    }
}

Click the build icon (green hammer top right) and you should then be able to see your script in the script selector.

oePf6p9.png

 

FAQ

Q: I followed the instructions and everything is red?

Your dependencies are not imported properly.

Q: I don't see the script in the script list?

You're not building the artifact properly. Ensure that "Include in Project Build" is checked, your output directory is correct, and your compile output is under the output root (left column). See below:

3odyBwI.png

  • Like 4
  • Thanks 1
Link to comment
Share on other sites

  • Koala pinned and featured this topic
  • 10 months later...

Since it's a little outdated, would like to get some help if possible, trying to compile code get this warning:


Executing pre-compile tasks...
Running 'before' tasks
Checking sources
Parsing java… [PrivateMiner]
java: JPS incremental annotation processing is disabled. Compilation results on partial recompilation may be inaccurate. Use build process "jps.track.ap.dependencies" VM flag to enable/disable incremental annotation processing environment.
Writing classes… [PrivateMiner]
Checking dependencies… [PrivateMiner]
Dependency analysis found 0 affected files
Updating dependency information… [PrivateMiner]
Adding @NotNull assertions… [PrivateMiner]
Adding pattern assertions… [PrivateMiner]
Adding Threading Model assertions… [PrivateMiner]
Building artifact 'unnamed'…
Deleting outdated files…
Building artifact 'unnamed': copying files…
Building archives…
Copying archives…
Running 'after' tasks
javac 18.0.2.1 was used to compile java sources
Finished, saving caches…
Executing post-compile tasks...
Finished, saving caches…
Synchronizing output directories...
9/9/2022 12:58 PM - Build completed successfully with 1 warning in 4 sec, 342 ms

 

When I open EpicBot with this script I get this error:


[12:59:13.484][ERROR][j][54] Error loading script PrivateMiner.class
java.lang.IllegalArgumentException
    at org.objectweb.asm.ClassReader.<init>(ClassReader.java:185)
    at org.objectweb.asm.ClassReader.<init>(ClassReader.java:168)
    at com.epicbot.commons.a.D(uw:80)
    at com.epicbot.core.v.v.M.D(ox:142)
    at com.epicbot.core.v.v.j.D(vs:92)
    at com.epicbot.core.v.v.j.D(vs:95)
    at com.epicbot.core.v.v.j.D(vs:95)
    at com.epicbot.core.v.v.j.D(vs:95)
    at com.epicbot.core.v.v.j.D(vs:95)
    at com.epicbot.core.v.v.j.D(vs:95)
    at com.epicbot.core.v.v.j.D(vs:174)
    at com.epicbot.core.settings.C.D(nm:88)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
[12:59:13.503][ERROR][j][54] Error loading script PrivateMiner.class
java.lang.IllegalArgumentException
    at org.objectweb.asm.ClassReader.<init>(ClassReader.java:185)
    at org.objectweb.asm.ClassReader.<init>(ClassReader.java:168)
    at com.epicbot.commons.a.D(uw:80)
    at com.epicbot.core.v.v.M.D(ox:142)
    at com.epicbot.core.v.v.j.D(vs:92)
    at com.epicbot.core.v.v.j.D(vs:95)
    at com.epicbot.core.v.v.j.D(vs:174)
    at com.epicbot.core.settings.C.D(nm:88)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
[12:59:13.510][ERROR][j][54] Error loading script PrivateMiner.class
java.lang.IllegalArgumentException
    at org.objectweb.asm.ClassReader.<init>(ClassReader.java:185)
    at org.objectweb.asm.ClassReader.<init>(ClassReader.java:168)
    at com.epicbot.commons.a.D(uw:80)
    at com.epicbot.core.v.v.M.D(ox:142)
    at com.epicbot.core.v.v.j.D(vs:92)
    at com.epicbot.core.v.v.j.D(vs:174)
    at com.epicbot.core.settings.C.D(nm:88)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

 

Any ideas or new tutorials of how to compile/run scripts?

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...
####################################################################                                                                                                                                            
                                                               
 _|    _|  _|_|_|    _|_|_|      _|_|    _|_|_|_|_|  _|_|_|_|  
 _|    _|  _|    _|  _|    _|  _|    _|      _|      _|        
 _|    _|  _|_|_|    _|    _|  _|_|_|_|      _|      _|_|_|    
 _|    _|  _|        _|    _|  _|    _|      _|      _|        
   _|_|    _|        _|_|_|    _|    _|      _|      _|_|_|_|  
                                                               
####################################################################    

                                                             
Followed this Youtube tutorial... which clued me into the fact that I needed to name the class the same as the file. Problem solved!

Hello,

This is a good tutorial. Got this up and running on Ubuntu 22.04.

Some problems I have faced and still engaged with.
1.) The "linux" zip for the install of EpicBot seems to contain an "exe". Which "wine" seemed to not like, but was able to just run it from terminal using "./EpicBot" (after giving rwx permissions to all files within "./Desktop/EpicBotFolder").
  a.) I believe its possible that the linux zip provided from the EpicBot downloads page may not be entirely correct... With this I don't think I'm able to locate where exactly to place the "scripts" folder. Can anyone point me in the right direction? As shown in the attached image, there are two "EpicBot" folders within my system.

Quote

/home/scripter/EpicBot                                          # Folder likely placed when running EpicBot.exe
/home/scripter/Desktop/EpicBotFolder/EpicBot      # My folder to house the extracted files
# Note see first image, right-side where the terminal is for the contents of each folder.

I've placed a "scripts" folder into both EpicBot folders, pointed my output of IntelliJ to these folder, ran the build on the test script written in the above tutorial... Yet never seem to be able to view the script from the EpicBot client.

Any guidance would be appreciated.
Thanks,
~ Prototype


 

Edited by PiquePrototype
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.

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.

 Share

×
×
  • Create New...