Jump to content
×
×
  • Create New...

[GUIDE] Running a Script from IntelliJ


Recommended Posts

If you're not able to run the client as most users do and have scripts from the SDN operate, this is the wrong guide for you.

If you're already running scripts and ready to write your own, keep reading.

 

If you haven't yet set up your IntelliJ project, start by making a new project that uses a java between Java 11 - 14.  Name it whatever you'd like.  I chose "DeleteSoon".

Download the Client SDK and Client SDK Scriptloader (https://powbot.org/community/index.php?/forum/56-downloads/) and put them somewhere convenient.  I have a folder on my desktop.

 

In your project, right click the main directory and choose "Open Module Settings"

yQxr29Q.png

Go to "Libraries" and add each .jar as a new Java project library using the + sign at the top.  I did them one at a time, I'm not sure if it matters though.

d1ObUCM.png

Tab over to "Modules" and make sure it looks like this:

sFam39A.png

 

Set up your directory paths, I'd recommend something like this:

nUQwvKj.png

If your folders are "combining" their names and you don't want them to, right click the space right above your main folder name and turn off "Flatten packages".

 

Make a java file called "TesterScript" like I did above.  Paste this into it and adjust your package name:

package authorname.scripts.tester;

import org.powbot.api.script.AbstractScript;
import org.powbot.api.script.ScriptManifest;
import org.powbot.mobile.service.ScriptUploader;

@ScriptManifest(
        name = "Tester EXACT NAME",
        description = "Tests",
        version = "0.0.1"
)

public class TesterScript extends AbstractScript {

    public static void main(String[] args) {
        new ScriptUploader().uploadAndStart("Tester EXACT NAME", "Account", null, false, true);
    }

    @Override
    public void poll() {
        System.out.println("You should see this in your console.");
    }

}

To launch a script, your manifest name and the name in your main() must match exactly.

Open a client like you normally would to run a script.  Wait for everything to finish loading.

Run the script by right clicking it in your project and selecting "Run main()"

aFtHHh3.png

If it doesn't run, try these command line scripts after adjusting the path to adb.exe:

C:\Users\NAME\.powbot\android\platform-tools\adb.exe kill-server
C:\Users\NAME\.powbot\android\platform-tools\adb.exe forward tcp:61666 tcp:61666
C:\Users\NAME\.powbot\android\platform-tools\adb.exe devices

It should look something like this:

0BWkTvd.png

These commands reset the link, tell you what devices are connected, and then set up communications.

 

If you still can't get a script running there's a bigger issue going on, ask in #help in Discord.

 

 

Some other useful info:

If you want to choose which client to attach the script to, run the adb.exe devices command.  An unbound client will have a name like "127.0.0.1:5557".  Replace null with that instance name string.

With AbstractScript poll() will get called approximately every 50ms, or instantly after finishing the previous poll() if it took longer than 50ms.

Edited by Joonks
Link to post
Share on other sites

  • Joonks changed the title to [GUIDE] Running a Script from IntelliJ
  • const_ pinned this topic

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.

 Share