Class TaskScript

java.lang.Object
com.botwithus.bot.api.script.TaskScript
All Implemented Interfaces:
BotScript

public abstract class TaskScript extends Object implements BotScript
Base class for task-based scripts. Maintains a priority-sorted list of Task instances and executes the first that validates each loop.
  • Method Details

    • onStart

      public void onStart(ScriptContext ctx)
      Description copied from interface: BotScript
      Called once when the script is started. Use this to initialize state and cache references from the context.
      Specified by:
      onStart in interface BotScript
      Parameters:
      ctx - the script context providing access to the GameAPI and event bus
    • onLoop

      public int onLoop()
      Description copied from interface: BotScript
      Called repeatedly while the script is running. The returned value controls the delay before the next invocation.
      Specified by:
      onLoop in interface BotScript
      Returns:
      delay in milliseconds before the next loop iteration, or -1 to stop the script
    • onStop

      public void onStop()
      Description copied from interface: BotScript
      Called once when the script is stopped, either by returning -1 from BotScript.onLoop() or by an external stop request. Use this to clean up resources.
      Specified by:
      onStop in interface BotScript
    • getConfigFields

      public List<ConfigField> getConfigFields()
      Description copied from interface: BotScript
      Returns the configurable fields this script exposes. Override this to declare user-editable parameters. The default implementation returns an empty list (no config).
      Specified by:
      getConfigFields in interface BotScript
      Returns:
      a list of config field descriptors
    • onConfigUpdate

      public void onConfigUpdate(ScriptConfig config)
      Description copied from interface: BotScript
      Called when the script's configuration is updated (at startup from persisted values, or at runtime from the config UI). The default implementation does nothing.
      Specified by:
      onConfigUpdate in interface BotScript
      Parameters:
      config - the new configuration snapshot