Class AbstractScript

    • Constructor Detail

      • AbstractScript

        public AbstractScript()
    • Method Detail

      • onStart

        public void onStart()
        Called when the script starts with no script parameters passed in.
      • onStart

        public void onStart​(java.lang.String... params)
        Called when the script is started with parameters
      • onSolverStart

        public boolean onSolverStart​(RandomSolver solver)
        Called during the random solver reset stage, before solver.onStart is called. Must return true in order for the solver.onStart to be called, and the solver to begin.
        Parameters:
        solver - The Random Solver that is about to be activated
        Returns:
        True starts the solver, false will delay the start.
      • onSolverEnd

        public void onSolverEnd​(RandomSolver solver)
        Called after the random solver has ended.
        Parameters:
        solver - The Random Solver that has just finished
      • onLoop

        public abstract int onLoop()
        This is the script's primary loop that runs as long as the script does.
        Returns:
        How long to wait in milliseconds before onLoop is called again. Note that returning a number less than 0 will result in the script being stopped.
      • onScheduledStop

        public boolean onScheduledStop()
        Called when the DreamBot Scheduler wants to stop the current script. Must return true in order for the script to actually begin stopping.
        Returns:
        True allows the script to stop, false will delay the stop
      • onExit

        public void onExit()
        Called when the script ends.
      • onPause

        public void onPause()
        Called when the script is paused.
      • onResume

        public void onResume()
        Called when the script is resumed.
      • onPaint

        public void onPaint​(java.awt.Graphics graphics)
        Handles the graphic for the script.
        Specified by:
        onPaint in interface PaintListener
        Parameters:
        graphics - The Graphics instance sent from the canvas.
      • onPaint

        public void onPaint​(java.awt.Graphics2D graphics)
        Handles the graphic for the script.
        Specified by:
        onPaint in interface PaintListener
        Parameters:
        graphics - The Graphics2D instance sent from the canvas.
      • buildRandomManager

        public final void buildRandomManager()
        Creates the random manager and thread for this script
      • stop

        public void stop()
      • run

        public final void run()
        Specified by:
        run in interface java.lang.Runnable
      • isPaused

        public boolean isPaused()
      • getVersion

        public double getVersion()
      • getSDNName

        public final java.lang.String getSDNName()
      • getThreadURL

        public final java.lang.String getThreadURL()
      • getScriptId

        public final int getScriptId()
      • getStoreId

        public final int getStoreId()
      • getSDNParameters

        public final java.lang.String getSDNParameters()
        This is arbitrary data you've included in the SDN as a String

        You can use this as a way to differentiate between scripts with a similar code base, such as a basic and advanced version, without needing to maintain two separate (but extremely similar) script repos/modules.

        Returns:
        The script parameters you've set on the SDN for this script, only shown during runs loaded from the SDN. If no parameters have been set, it will return an empty string.
      • getRandomThread

        public java.lang.Thread getRandomThread()