Class ScriptUtil


  • public class ScriptUtil
    extends java.lang.Object
    The ScriptUtil class provides utility methods for interacting with the scripting framework provided by the ORB API. It facilitates actions such as setting loop delays, stopping scripts, toggling user input, and displaying text on the game overlay.
    • Constructor Summary

      Constructors 
      Constructor Description
      ScriptUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addEventListener​(com.osrsbots.orb.api.events.framework.EventListener listener)  
      static void addSubscriptionListener​(java.lang.Object object)  
      static void debugActions​(boolean enabled)  
      static java.lang.String getDiscordUsername()  
      static void removeEventListener​(com.osrsbots.orb.api.events.framework.EventListener listener)  
      static void removeSubscriptionListener​(java.lang.Object object)  
      static void setLoopDelay​(int min, int max)
      Sets the loop delay for the script execution within the specified range.
      static void setTasks​(java.util.List<ScriptTask> tasks)  
      static void stop()
      Stops the script execution without providing a specific message.
      static void stop​(java.lang.String msg)
      Stops the script execution with an optional message.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ScriptUtil

        public ScriptUtil()
    • Method Detail

      • setLoopDelay

        public static void setLoopDelay​(int min,
                                        int max)
        Sets the loop delay for the script execution within the specified range. Script#onLoop() will be called every min-max milliseconds.
        Parameters:
        min - Minimum loop delay in milliseconds.
        max - Maximum loop delay in milliseconds.
      • setTasks

        public static void setTasks​(@Nonnull
                                    java.util.List<ScriptTask> tasks)
      • stop

        public static void stop​(java.lang.String msg)
        Stops the script execution with an optional message. Script#onStop() is immediately called.
        Parameters:
        msg - Optional message to be displayed when stopping the script.
      • stop

        public static void stop()
        Stops the script execution without providing a specific message. Script#onStop() is immediately called.
      • addSubscriptionListener

        public static void addSubscriptionListener​(@Nonnull
                                                   java.lang.Object object)
      • removeSubscriptionListener

        public static void removeSubscriptionListener​(@Nonnull
                                                      java.lang.Object object)
      • addEventListener

        public static void addEventListener​(@Nonnull
                                            com.osrsbots.orb.api.events.framework.EventListener listener)
      • removeEventListener

        public static void removeEventListener​(@Nonnull
                                               com.osrsbots.orb.api.events.framework.EventListener listener)
      • getDiscordUsername

        public static java.lang.String getDiscordUsername()
      • debugActions

        public static void debugActions​(boolean enabled)