Class AbstractScript

  • All Implemented Interfaces:
    java.lang.Runnable, java.util.EventListener, PaintListener
    Direct Known Subclasses:
    TaskScript

    public abstract class AbstractScript
    extends MethodContext
    implements java.lang.Runnable, PaintListener
    Created with IntelliJ IDEA. User: NotoriousPP Date: 9/28/2014 Time: 5:49 PM
    • Constructor Detail

      • AbstractScript

        public AbstractScript()
    • Method Detail

      • getStartTile

        public Tile getStartTile()
      • getRandomThread

        public java.lang.Thread getRandomThread()
      • onStart

        public void onStart()
        Called when the script starts.
      • 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.
      • onLoop

        public abstract int onLoop()
        Called in cycles.
      • 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.
      • onGameState

        public GameState onGameState​(GameState gameState)
        Handles incoming game state changes.
        Parameters:
        gameState - The most recent game state change to occur.
      • registerMethodContext

        public final void registerMethodContext​(Client client)
        Registers the method context of the script
        Parameters:
        client - The client
      • stop

        public void stop()
      • run

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

        public boolean isPaused()
      • getVersion

        public double getVersion()
      • getSDNName

        public java.lang.String getSDNName()
      • getThreadURL

        public java.lang.String getThreadURL()
      • getStoreId

        public int getStoreId()
      • getSDNParameters

        public 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'll return an empty string.