Skip to main content

Environment Setup

Install Java JDK​

For building your scripts, you will need to install the Java Development Kit (JDK). We recommend Java 11 JDK, which you can download from the Adoptium website.

Install IntelliJ IDEA​

We recommend using IntelliJ IDEA as your development environment. You can download the Community Edition from the JetBrains website.

Create a Project in IntelliJ IDEA​


1. Open IntelliJ IDEA​

You will see the welcome screen. Click on New Project.

Intellij IDEA Welcome

2. Project Configuration​

Select the following settings for your project (also see the screenshot below):

  • Name and Location: Choose a name and location for your project
  • Language: Java
  • Build System: Gradle
  • SDK: The Java JDK you installed earlier (e.g. 11, 11.0.19)
  • Gradle DSL: Kotlin

Intellij IDEA Project Configuration

3. Inside the Project​

You will see the following in your project window:

Intellij IDEA Project Window

You can now set up a basic script in your project.

Create a new file in the src/main/java directory and name it Main.java. You can use the following code as a starting point:

@ScriptManifest(
name = "EternalClientScript",
description = "A script for EternalClient.",
author = "EternalClient",
category = ScriptCategory.OTHER,
version = 1.0
)
public class Main extends AbstractScript
{
@Override
public void onStart(String[] strings)
{
// This method is called when the script is started with the script paramters.
}

@Override
public void onExit()
{
// This method is called when the script is stopped.
}

@Override
public void onPause()
{
// This method is called when the script is paused.
}

@Override
public void onResume()
{
// This method is called when the script is resumed.
}

@Override
public int onLoop()
{
// The returned value is the duration in milliseconds that it will sleep before calling onLoop again.
return 0;
}
}

Building the Script​

First, we will need to modify the build.gradle.kts file:

val userHomeDir: String = System.getProperty("user.home");

plugins {
java
}

repositories {
mavenLocal()
mavenCentral()
}

dependencies {
// Adding the EternalClient API as a compileOnly dependency.
compileOnly(files("${userHomeDir}/EternalClient/Data/EternalClient.jar"))
}

// Changing this will make it so that the jar file is named differently
val scriptFileName: String = "EternalClientScript"

tasks {
jar {
archiveFileName.set("${scriptFileName}.jar")

// Destination directory for the jar file, EternalClients local script directory.
destinationDirectory.set(file("$userHomeDir/EternalClient/Scripts"))
}
}

This will make it so that whenever Eternal Client is updated, you will not have to change the build.gradle.kts file.

The scriptFileName variable can be changed to whatever you want the jar file to be named.

After modifying the build.gradle.kts file, you can build the script by running the jar task in the Gradle tool window.

Intellij IDEA Project Gradle Tool Window

Now whenever you run the jar task, it will build the script and place it in the EternalClient script directory.

Done!​

You can then run the script on EternalClient.