Interface BotScript

All Known Implementing Classes:
TaskScript

public interface BotScript
Service Provider Interface for bot scripts.

Implementations are discovered at runtime via ServiceLoader. Each script follows a lifecycle of onStart(ScriptContext) → onLoop() → onStop().

Annotate implementations with ScriptManifest to declare metadata.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    default List<ConfigField>
    Returns the configurable fields this script exposes.
    default ScriptUI
    Returns a custom UI for this script, rendered in the Script UI panel.
    default void
    Called when the script's configuration is updated (at startup from persisted values, or at runtime from the config UI).
    int
    Called repeatedly while the script is running.
    void
    Called once when the script is started.
    void
    Called once when the script is stopped, either by returning -1 from onLoop() or by an external stop request.
  • Method Details

    • onStart

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

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

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

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

      default void onConfigUpdate(ScriptConfig config)
      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.
      Parameters:
      config - the new configuration snapshot
    • getUI

      default ScriptUI getUI()
      Returns a custom UI for this script, rendered in the Script UI panel. Override this to provide interactive widgets, status displays, or controls beyond what getConfigFields() offers.

      The returned ScriptUI is called every frame while its panel is showing; see ScriptUI.render() for where and how. Return null (the default) if this script has no custom UI.

      Returns:
      a ScriptUI implementation, or null