Package rsb.methods
Class Methods
java.lang.Object
rsb.methods.Methods
- Direct Known Subclasses:
PassiveScript
,Random
,Script
Provides access to methods that can be used by RSBot scripts.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the current client's local player.void
init
(MethodContext ctx) For internal use only: initializes the method providers.void
Prints to the RSBot log with a font colorvoid
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.
-
Field Details
-
ctx
-
-
Constructor Details
-
Methods
public Methods()
-
-
Method Details
-
init
For internal use only: initializes the method providers.- Parameters:
ctx
- The MethodContext.
-
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
Checks for the existence of a NPC.- Parameters:
npc
- The NPC to check for.- Returns:
true
if found.
-
verify
Checks for the existence of a RSObject.- Parameters:
o
- The RSObject to check for.- Returns:
true
if found.
-
verify
Checks for the existence of a RSTile.- Parameters:
t
- The RSTile to check for.- Returns:
true
if found.
-
verify
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
Prints to the RSBot log.- Parameters:
message
- Object to log.
-
log
Prints to the RSBot log with a font color- Parameters:
color
- The color of the fontmessage
- Object to log
-