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
  • script wont start


    st1nklr

    Recommended Posts

    Ive been learning how to script so i was messing around trying to make a cow killing script but when i go to run it it just doesnt start 

    this appeared in the debug console 

    22:13:03: 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.0.1.1.3.4.2(4.java:256)
        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)

    Link to comment
    Share on other sites

    8 hours ago, PapayaBrownie said:

    Can you post or message me your source code to see what could be wrong?

    Yes my bad for the very late response 

    import org.dreambot.api.methods.filter.Filter;
    import org.dreambot.api.methods.map.Area;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.wrappers.interactive.NPC;

    @ScriptManifest(author = "You", name = "CowKiller", version = 1.0, description = "Simple CowKiller", category = Category.COMBAT)
    public abstract class CowScript extends AbstractScript {
        public static final Filter<NPC> COWFILTER = new Filter<NPC>() {

            @Override
            public boolean match(NPC npc) {
                if (npc == null) {
                    return false;
                }
                if (npc.getName().equals("Cow") && !npc.isHealthBarVisible()) {
                    return true;

                } else {
                    return false;
                }
            }
        };

            Area CowArea = new Area(3209, 3302, 3192, 3282);

            @Override
            public int onLoop() {
                if (getLocalPlayer().isInCombat()) {

                } else if (CowArea.contains(getLocalPlayer())) {
                    NPC cow = getNpcs().closest("Cow");
                    if (cow != null) {
                        cow.interact("Attack");
                    }

                } else {
                  getWalking().walk(CowArea.getRandomTile());
                }
                return 1000;

            }
    }

     

    Eclipse doesnt seem to be registering any errors in it 

    Link to comment
    Share on other sites

    public abstract class CowScript extends AbstractScript 

    You declared your class abstract. You can't instantiate an abstract class. That's why you get " java.lang.InstantiationException" in the debug console.

    Link to comment
    Share on other sites

    7 minutes ago, Shy said:
    
    public abstract class CowScript extends AbstractScript 

    You declared your class abstract. You can't instantiate an abstract class. That's why you get " java.lang.InstantiationException" in the debug console.

    Ah i see, yeah that fixed it thank you very much for the response

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • 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.