Venom7 0 Posted January 10, 2020 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.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.