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 not running


    Stormscythe

    Recommended Posts

    Posted

    Whenever I run a script that I made, it is not running. The Script Overview window is not closing, and the script does nothing. Is that a problem with my script, or the client?

     

     

    Source:

     

    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.utilities.impl.Condition;
    import org.dreambot.api.wrappers.interactive.GameObject;
    import org.dreambot.api.wrappers.interactive.NPC;

    @ScriptManifest(author = "Stormscythe", name = "The Monk Killer", version = 1.0, description = "Kills monks at edge", category = Category.COMBAT)
    public class main extends AbstractScript {


    NPC monk = getNpcs().closest("Monk");


    public void onStart() {
    log("Welcome to Simple Tea Thiever by Apaec.");
    log("If you experience any issues while running this script please report them to me on the forums.");
    log("Enjoy the script, gain some thieving levels!.");
    }

    private enum State {
    FIGHTING, ATTACK, HEAL, WAIT,
    };

    private State getState() {
    if (getPlayers().myPlayer().isInCombat())
    return State.FIGHTING;
    if (!getPlayers().myPlayer().isInCombat())
    return State.ATTACK;
    if (getPlayers().myPlayer().getHealthPercent() < 20)
    return State.HEAL;
    return State.WAIT;
    }

    public void onExit() {

    }

    @Override
    public int onLoop() {

    switch (getState()) {

    case FIGHTING:
    sleep(200,500);
    break;
    case ATTACK:
    if(monk != null){
    if (monk.isOnScreen()){
    if(!monk.isInCombat()){
    monk.interact("Attack");
    AbstractScript.sleepUntil(new Condition() {

    @Override
    public boolean verify() {
    return getPlayers().myPlayer().isInCombat();
    }

    }, 1000);
    }
    }
    }
    break;
    case HEAL:
    //code to drop tea here
    break;
    case WAIT:
    //code to wait here
    break;
    }
    return Calculations.random(500, 600);
    }
    }

     

    Posted

    Does the console logs that the script started successfully?

    Posted

    Run the client through cmd and check for any errors.

    You can do that by opening the cmd window and typing

    java -jar path\to\client.jar

     

    replace path\to\ with your dreambot path C:\users\username\dreambot\botdata\client.jar

    Posted

    Run the client through cmd and check for any errors.

    You can do that by opening the cmd window and typing

    java -jar path\to\client.jar

     

    replace path\to\ with your dreambot path C:\users\username\dreambot\botdata\client.jar

     

    Here is what that logged

     

     

    C:\Users\Sperminator>java -jar C:\users\sperminator\dreambot\botdata\client.jar

    log4j:WARN No such property [conversionPattern] in org.apache.log4j.PatternLayou

    t.

    log4j:WARN No such property [conversionPattern] in org.apache.log4j.PatternLayou

    t.

    log4j:WARN No such property [maxFileSize] in org.apache.log4j.RollingFileAppende

    r.

    log4j:WARN No such property [file] in org.apache.log4j.RollingFileAppender.

    log4j:WARN File option not set for appender [LocalFile].

    log4j:WARN Are you using FileAppender instead of ConsoleAppender?

    00:01 INFO: [kryonet] Connecting: dreambot.org/192.169.82.198:34343

    00:01 INFO: [kryonet] Connection 202 connected: dreambot.org/192.169.82.198

    Tab count: 0

    Starting new applet

    log4j:ERROR No output stream or file set for the appender named [LocalFile].

    Loaded 319 field definitions.

    false

    Loading web nodes...

    Loaded 2045 nodes!

    00:44 INFO: [kryonet] Connection 202 disconnected.

    00:45 INFO: [kryonet] Connecting: dreambot.org/192.169.82.198:34343

    00:45 INFO: [kryonet] Connection 203 connected: dreambot.org/192.169.82.198

    Tab count: 1

    Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java

    .lang.reflect.InvocationTargetException

    at javafx.fxml.FXMLLoader$MethodHandler.invoke(Unknown Source)

    at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(Unknown So

    urce)

    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unkn

    own Source)

    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknow

    n Source)

    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknow

    n Source)

    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(U

    nknown Source)

    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Sourc

    e)

    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Sou

    rce)

    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Sourc

    e)

    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Sou

    rce)

    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Sourc

    e)

    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Sou

    rce)

    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Sourc

    e)

    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Sou

    rce)

    at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)

    at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)

    at javafx.event.Event.fireEvent(Unknown Source)

    at javafx.scene.Node.fireEvent(Unknown Source)

    at javafx.scene.control.Button.fire(Unknown Source)

    at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(Un

    known Source)

    at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(Unknown S

    ource)

    at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(Unknown S

    ource)

    at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.h

    andleBubblingEvent(Unknown Source)

    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unkn

    own Source)

    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknow

    n Source)

    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknow

    n Source)

    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(U

    nknown Source)

    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Sourc

    e)

    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Sou

    rce)

    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Sourc

    e)

    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Sou

    rce)

    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Sourc

    e)

    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Sou

    rce)

    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Sourc

    e)

    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Sou

    rce)

    at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)

    at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)

    at javafx.event.Event.fireEvent(Unknown Source)

    at javafx.scene.Scene$MouseHandler.process(Unknown Source)

    at javafx.scene.Scene$MouseHandler.access$1500(Unknown Source)

    at javafx.scene.Scene.impl_processMouseEvent(Unknown Source)

    at javafx.scene.Scene$ScenePeerListener.mouseEvent(Unknown Source)

    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotificatio

    n.run(Unknown Source)

    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotificatio

    n.run(Unknown Source)

    at java.security.AccessController.doPrivileged(Native Method)

    at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEve

    nt$350(Unknown Source)

    at com.sun.javafx.tk.quantum.GlassViewEventHandler$$Lambda$506/158732842

    4.get(Unknown Source)

    at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(Unknown

    Source)

    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(Unkn

    own Source)

    at com.sun.glass.ui.View.handleMouseEvent(Unknown Source)

    at com.sun.glass.ui.View.notifyMouse(Unknown Source)

    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)

    at com.sun.glass.ui.win.WinApplication.lambda$null$145(Unknown Source)

    at com.sun.glass.ui.win.WinApplication$$Lambda$53/1367039948.run(Unknown

    Source)

    at java.lang.Thread.run(Unknown Source)

    Caused by: java.lang.reflect.InvocationTargetException

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

    at java.lang.reflect.Method.invoke(Unknown Source)

    at sun.reflect.misc.Trampoline.invoke(Unknown Source)

    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

    at java.lang.reflect.Method.invoke(Unknown Source)

    at sun.reflect.misc.MethodUtil.invoke(Unknown Source)

    ... 55 more

    Caused by: java.lang.NullPointerException

    at main.(main.java:13)

    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

     

    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

     

    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou

    rce)

    at java.lang.reflect.Constructor.newInstance(Unknown Source)

    at java.lang.Class.newInstance(Unknown Source)

    at org.dreambot.api.script.ScriptManager.start(ScriptManager.java:114)

    at org.dreambot.gui.g.b.start(b.java:175)

    ... 64 more

     

    Does the console logs that the script started successfully?

     

    Says: Script started: <Name>

    Posted

    You're problem is this:

    NPC monk = getNpcs().closest("Monk");
    

    You can't make any context call before onStart, just use:

    NPC monk;
    

    and in onStart set it:

    monk = getNpcs().closest("Monk");
    
    Posted

     

    You're problem is this:

    NPC monk = getNpcs().closest("Monk");
    

    You can't make any context call before onStart, just use:

    NPC monk;
    

    and in onStart set it:

    monk = getNpcs().closest("Monk");
    

     

    Oh wow, can't believe I did not see that - thank you :-P

    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.