Sign in to follow this  
ChonkyFish

Can't run local scripts

Recommended Posts

Java Version: 1.8.0_221

 

So i've tried RZME's guide on setting up RSBot to run local scripts but the bot wont find my local scripts. The problem is that in the scripts window it wont show my local script. It shows all my other scripts that i've added through powerbot.

 

I get this error in the console log of IntelliJIDEA:

Error: client.init:1229 sun.reflect.NativeMethodAccessorImpl.invoke0 sun.reflect.NativeMethodAccessorImpl.invoke:62 sun.reflect.DelegatingMethodAccessorImpl.invoke:43 java.lang.reflect.Method.invoke:498 Rs2Applet.a:15 Rs2Applet.init:497 app.appletviewer.lambda$load$0:103 java.awt.event.InvocationEvent.dispatch:311 java.awt.EventQueue.dispatchEventImpl:758 java.awt.EventQueue.access$500:97 java.awt.EventQueue$3.run:709 java.awt.EventQueue$3.run:703 java.security.AccessController.doPrivileged java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege:74 java.awt.EventQueue.dispatchEvent:728 java.awt.EventDispatchThread.pumpOneEventForFilters:205 java.awt.EventDispatchThread.pumpEventsForFilter:116 java.awt.EventDispatchThread.pumpEventsForHierarchy:105 java.awt.EventDispatchThread.pumpEvents:101 java.awt.EventDispatchThread.pumpEvents:93 java.awt.EventDispatchThread.run:82 | java.lang.RuntimeException |

 

but I don't get any errors in rsbot logs. Is anyone else getting this error? Could this be preventing me from running local scripts, or rsbot from finding my scripts? Any help would be appreciated. Thank you.

Share this post


Link to post


I followed your guide:

 

Here is my Task:

import org.powerbot.script.rt6.ClientAccessor;
import org.powerbot.script.rt6.ClientContext;

public abstract class Task extends ClientAccessor {
    public Task(ClientContext ctx) {
        super(ctx);
    }

    public abstract boolean activate();
    public abstract void execute();
}

 

Drop:

import org.powerbot.script.rt6.ClientContext;
import org.powerbot.script.rt6.Item;

public class Drop extends Task {
    private int logId = 1511;

    public Drop(ClientContext ctx) {
        super(ctx);
    }

    @Override
    public boolean activate() {
        return ctx.backpack.select().count() == 28;
    }

    @Override
    public void execute() {
        for (Item i : ctx.backpack.id(logId)) {
            i.interact("Drop");
        }
    }
}

 

Chop:

import org.powerbot.script.rt6.ClientContext;
import org.powerbot.script.rt6.GameObject;

public class Chop extends Task {
    private int[] treeIds = {38616, 38627, 58006};

    public Chop(ClientContext ctx) {
        super(ctx);
    }

    @Override
    public boolean activate() {
        return ctx.backpack.select().count() < 28
                && !ctx.objects.select().id(treeIds).isEmpty()
                && ctx.players.local().animation() == -1;
    }

    @Override
    public void execute() {
        GameObject tree = ctx.objects.nearest().poll();

        if (tree.inViewport()) {
            tree.interact("Chop");
        } else {
            ctx.movement.step(tree);
            ctx.camera.turnTo(tree);
        }
    }
}

 

PowerChopper:

import org.powerbot.script.Script;
import org.powerbot.script.rt6.ClientContext;
import org.powerbot.script.PollingScript;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@Script.Manifest(name="PowerChopper", description="Chops wood")
public class PowerChopper extends PollingScript<ClientContext> {
    private List<Task> taskList = new ArrayList<Task>();

    @Override
    public void start() {
        taskList.addAll(Arrays.asList(new Chop(ctx), new Drop(ctx)));
    }

    @Override
    public void poll() {
        for (Task task : taskList) {
            if (task.activate()) {
                task.execute();
            }
        }
    }

}

 

Also I just got AdoptOpenJDK, which was recommended, I was hoping that maybe that would fix any issues. Now I am getting a new error:

 

sun.awt.image.ImageFormatException: Unsupported color conversion request
    at sun.awt.image.JPEGImageDecoder.readImage(Native Method)
    at sun.awt.image.JPEGImageDecoder.produceImage(JPEGImageDecoder.java:141)
    at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:269)
    at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:205)
    at sun.awt.image.ImageFetcher.run(ImageFetcher.java:169)

 

I can post pictures of my configuration too if needed.

Share this post


Link to post
Coma   

Scripts are loaded from your classpath, so make sure they are compiled to a directory in your classpath. You can configure that in IntelliJ settings.

Share this post


Link to post

Yup they are being compiled to a directory in my classpath:

 

"C:\Program Files (x86)\AdoptOpenJDK\jdk-8.0.222.10-hotspot\jre\bin\java.exe" -Xmx768m -XX:+UseG1GC -Dcom.jagex.config=www "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.1.2\lib\idea_rt.jar=61858:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.1.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files (x86)\AdoptOpenJDK\jdk-8.0.222.10-hotspot\jre\lib\charsets.jar;C:\Program Files (x86)\AdoptOpenJDK\jdk-8.0.222.10-hotspot\jre\lib\ext\access-bridge-32.jar;C:\Program Files (x86)\AdoptOpenJDK\jdk-8.0.222.10-hotspot\jre\lib\ext\access-bridge.jar;C:\Program Files (x86)\AdoptOpenJDK\jdk-8.0.222.10-hotspot\jre\lib\ext\cldrdata.jar;C:\Program Files (x86)\AdoptOpenJDK\jdk-8.0.222.10-hotspot\jre\lib\ext\dnsns.jar;C:\Program Files (x86)\AdoptOpenJDK\jdk-8.0.222.10-hotspot\jre\lib\ext\jaccess.jar;C:\Program Files (x86)\AdoptOpenJDK\jdk-8.0.222.10-hotspot\jre\lib\ext\localedata.jar;C:\Program Files (x86)\AdoptOpenJDK\jdk-8.0.222.10-hotspot\jre\lib\ext\nashorn.jar;C:\Program Files (x86)\AdoptOpenJDK\jdk-8.0.222.10-hotspot\jre\lib\ext\sunec.jar;C:\Program Files (x86)\AdoptOpenJDK\jdk-8.0.222.10-hotspot\jre\lib\ext\sunjce_provider.jar;C:\Program Files (x86)\AdoptOpenJDK\jdk-8.0.222.10-hotspot\jre\lib\ext\sunmscapi.jar;C:\Program Files (x86)\AdoptOpenJDK\jdk-8.0.222.10-hotspot\jre\lib\ext\sunpkcs11.jar;C:\Program Files (x86)\AdoptOpenJDK\jdk-8.0.222.10-hotspot\jre\lib\ext\zipfs.jar;C:\Program Files (x86)\AdoptOpenJDK\jdk-8.0.222.10-hotspot\jre\lib\jce.jar;C:\Program Files (x86)\AdoptOpenJDK\jdk-8.0.222.10-hotspot\jre\lib\jsse.jar;C:\Program Files (x86)\AdoptOpenJDK\jdk-8.0.222.10-hotspot\jre\lib\management-agent.jar;C:\Program Files (x86)\AdoptOpenJDK\jdk-8.0.222.10-hotspot\jre\lib\resources.jar;C:\Program Files (x86)\AdoptOpenJDK\jdk-8.0.222.10-hotspot\jre\lib\rt.jar;        C:\Users\Nanybany\IdeaProjects\PowerChopper\out;          C:\Users\Nanybany\IdeaProjects\PowerChopper\RSBot.jar" jagexappletviewer;

 

my class path consists of all that stuff which I am too noobish to understand, but I can clearly see the spaced entry (spaced for readability) is where my compiled classes are located.

 

I also tried DopeAssFreshPrince's bat file:

@ECHO OFF
java -Xmx768m -XX:+UseG1GC -cp "C:\Users\Nanybany\IdeaProjects\PowerChopper\out;C:\Users\Nanybany\IdeaProjects\PowerChopper\RSBot.jar" jagexappletviewer
pause

 

and it wouldn't find load the script.

 

Share this post


Link to post
Coma   

I think there was an old issue where scripts could not be loaded from the default package. Try putting your scripts in a package, do a clean and rebuild, then try again.

Share this post


Link to post
3 hours ago, Coma said:

I think there was an old issue where scripts could not be loaded from the default package. Try putting your scripts in a package, do a clean and rebuild, then try again.

That was it. Thank you.

Share this post


Link to post

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.

Loading...
Sign in to follow this