Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • Need some help with my script (getting an error in debug console)


    Venom7
     Share

    Recommended Posts

    I'm making a pest control script and decided to give nodes a shot. I understand the concept behind them and have knowledge in coding since I am a Computer Science student. However, I am getting the following error when I start the script. I have made about 5 other scripts already but those were only using conditional logic since I was lazy and it served my purpose at the time lol.

    [ERROR]01:07:30: Error occurred while trying to start script:
    	java.lang.InstantiationException
    	at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(Unknown Source)
    	at java.lang.reflect.Constructor.newInstance(Unknown Source)
    	at java.lang.Class.newInstance(Unknown Source)
    	at org.dreambot.api.script.ScriptManager.start(ScriptManager.java:99)
    	at org.dreambot.1.2.3.0.4.0(4.java:255)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$500(Unknown Source)
    	at java.awt.EventQueue$3.run(Unknown Source)
    	at java.awt.EventQueue$3.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue$4.run(Unknown Source)
    	at java.awt.EventQueue$4.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    

    I will post the code for the script as well. Currently, it only has walking to the intermediate boat since I test as i code. 

    Main:

    public abstract class PestControl extends AbstractScript {
        private Node[] nodes;
    
        public final Area WAITING_AREA = new Area(2657,2638,2638,2655,0);
        public final Tile INTERMEDIATE_BOAT = new Tile(2640,2644,0);
    
        @Override
        public void onStart() {
            PassableObstacle gangplank = new PassableObstacle("Gangplank", "Cross", null, null, null);
            getWalking().getAStarPathFinder().addObstacle(gangplank);
    
            nodes = new Node[]{
                    new Start(this)
            };
        }
    
        @Override
        public int onLoop() {
            for(Node node : nodes){
                if(node.validate()){
                    node.execute();
                    break;
                }
            }
            log("No node execcuted.");
            return Calculations.random(958,1012);
        }
    }

    Walking Node:

    public class Start extends Node {
        public Start(PestControl main) {
            super(main);
        }
    
        @Override
        public boolean validate() {
            return c.WAITING_AREA.contains(c.getLocalPlayer()) && !c.getLocalPlayer().getTile().equals(c.INTERMEDIATE_BOAT);
        }
    
        @Override
        public void execute() {
                c.getWalking().walk(c.INTERMEDIATE_BOAT);
        }
    }

    Node Class:

    public abstract class Node {
        protected final PestControl c;
    
        public Node(PestControl main){
            this.c = main;
        }
    
        public abstract boolean validate();
        public abstract void execute();
    }

    Any help would be appreciated.

    Edited by Venom7
    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.