Package rsb.methods

Class Methods

java.lang.Object
rsb.methods.Methods
Direct Known Subclasses:
PassiveScript, Random, Script

public class Methods extends Object
Provides access to methods that can be used by RSBot scripts.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the current client's local player.
    void
    For internal use only: initializes the method providers.
    void
    log(Color color, Object message)
    Prints to the RSBot log with a font color
    void
    log(Object message)
    Prints to the RSBot log.
    static double
    random(double min, double max)
    Returns a random double with min as the inclusive lower bound and max as the exclusive upper bound.
    static int
    random(int min, int max)
    Returns a random integer with min as the inclusive lower bound and max as the exclusive upper bound.
    static void
    sleep(int toSleep)
    Pauses execution for a given number of milliseconds.
    static void
    sleep(int minSleep, int maxSleep)
    Pauses execution for a random amount of time between two values.
    boolean
    Checks for the existence of a RSGroundItem.
    boolean
    Checks for the existence of a NPC.
    boolean
    Checks for the existence of a RSObject.
    boolean
    Checks for the existence of a RSTile.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • Methods

      public Methods()
  • Method Details

    • init

      public void init(MethodContext ctx)
      For internal use only: initializes the method providers.
      Parameters:
      ctx - The MethodContext.
    • getMyPlayer

      public RSPlayer getMyPlayer()
      Returns the current client's local player.
      Returns:
      The current client's RSPlayer.
      See Also:
    • random

      public static int random(int min, int max)
      Returns a random integer with min as the inclusive lower bound and max as the exclusive upper bound.
      Parameters:
      min - The inclusive lower bound.
      max - The exclusive upper bound.
      Returns:
      Random integer min (less than or equal) to n (less than) max.
    • verify

      public boolean verify(RSNPC npc)
      Checks for the existence of a NPC.
      Parameters:
      npc - The NPC to check for.
      Returns:
      true if found.
    • verify

      public boolean verify(RSObject o)
      Checks for the existence of a RSObject.
      Parameters:
      o - The RSObject to check for.
      Returns:
      true if found.
    • verify

      public boolean verify(RSTile t)
      Checks for the existence of a RSTile.
      Parameters:
      t - The RSTile to check for.
      Returns:
      true if found.
    • verify

      public boolean verify(RSGroundItem i)
      Checks for the existence of a RSGroundItem.
      Parameters:
      i - The RSGroundItem to check for.
      Returns:
      true if found.
    • random

      public static double random(double min, double max)
      Returns a random double with min as the inclusive lower bound and max as the exclusive upper bound.
      Parameters:
      min - The inclusive lower bound.
      max - The exclusive upper bound.
      Returns:
      Random double min (less than or equal) to n (less than) max.
    • sleep

      public static void sleep(int minSleep, int maxSleep)
      Pauses execution for a random amount of time between two values.
      Parameters:
      minSleep - The minimum time to sleep.
      maxSleep - The maximum time to sleep.
      See Also:
    • sleep

      public static void sleep(int toSleep)
      Pauses execution for a given number of milliseconds.
      Parameters:
      toSleep - The time to sleep in milliseconds.
    • log

      public void log(Object message)
      Prints to the RSBot log.
      Parameters:
      message - Object to log.
    • log

      public void log(Color color, Object message)
      Prints to the RSBot log with a font color
      Parameters:
      color - The color of the font
      message - Object to log