Package com.osrsbots.orb.api.util
Class Delay
- java.lang.Object
-
- com.osrsbots.orb.api.util.Delay
-
public class Delay extends java.lang.ObjectThe Delay class provides methods for introducing delays and waiting for specific conditions during script execution.
-
-
Constructor Summary
Constructors Constructor Description Delay()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidticks(int amount)Waits for the provided amount of Game ticks to occur.static booleanuntil(java.util.function.BooleanSupplier condition, int minTimeout, int maxTimeout)Waits until a specified condition is met or a timeout occurs, using default interval values.static booleanuntil(java.util.function.BooleanSupplier condition, int minInterval, int maxInterval, long timeout)Waits until a specified condition is met or a timeout occurs.static booleanuntilAnimating(int minTimeout, int maxTimeout)Waits until the local Player is animating, where "animating" is defined by theRSActor.getAnimation()!= -1, or a timeout occurs.static booleanuntilAnimating(RSActor rsa, int minTimeout, int maxTimeout)Waits until the specified actor is animating, where "animating" is defined by theRSActor.getAnimation()!= -1, or a timeout occurs.static booleanuntilBankIsOpen(int minTimeout, int maxTimeout)Waits untilBank.isOpen()or a timeout occurs.static booleanuntilIdle(int idleLimit, int minTimeout, int maxTimeout)Waits until the local player becomes idle, where "idle" is defined by theRSActor.getAnimation()== -1, until a specified number of idle checks are met or a timeout occurs.static booleanuntilIdle(RSActor rsa, int idleLimit, int minTimeout, int maxTimeout)Waits until the specified actor becomes idle, where "idle" is defined by theRSActor.getAnimation()== -1, until a specified number of idle checks are met or a timeout occurs.static booleanuntilInteracting(int minTimeout, int maxTimeout)Waits until the local PlayerRSActor.isInteracting()or a timeout occurs.static booleanuntilInteracting(RSActor rsa, int minTimeout, int maxTimeout)Waits until the specified ActorRSActor.isInteracting()or a timeout occurs.static booleanuntilMoving(int minTimeout, int maxTimeout)Waits until the local PlayerRSActor.isMoving()or a timeout occurs.static booleanuntilMoving(RSActor rsa, int minTimeout, int maxTimeout)Waits until the specified ActorRSActor.isMoving()or a timeout occurs.static booleanuntilShopIsOpen(int minTimeout, int maxTimeout)Waits untilShop.isOpen()or a timeout occurs.static voidwait(int timeout)Pauses the script execution for the specified timeout.static voidwait(int minTimeout, int maxTimeout)Pauses the script execution for a random timeout within the specified range.static booleanwhileAnimating(int minTimeout, int maxTimeout)Waits while the local Player is animating, where "animating" is defined by theRSActor.getAnimation()!= -1, or a timeout occurs.static booleanwhileAnimating(RSActor rsa, int minTimeout, int maxTimeout)Waits while the specified actor is animating, where "animating" is defined by theRSActor.getAnimation()!= -1, or a timeout occurs.static booleanwhileBankIsOpen(int minTimeout, int maxTimeout)Waits whileBank.isOpen()or a timeout occurs.static booleanwhileInteracting(int minTimeout, int maxTimeout)Waits while the local PlayerRSActor.isInteracting()or a timeout occurs.static booleanwhileInteracting(RSActor rsa, int minTimeout, int maxTimeout)Waits while the specified ActorRSActor.isInteracting()or a timeout occurs.static booleanwhileMoving(int minTimeout, int maxTimeout)Waits while the local PlayerRSActor.isMoving()or a timeout occurs.static booleanwhileMoving(RSActor rsa, int minTimeout, int maxTimeout)Waits while the specified ActorRSActor.isMoving()or a timeout occurs.static booleanwhileShopIsOpen(int minTimeout, int maxTimeout)Waits whileShop.isOpen()or a timeout occurs.
-
-
-
Method Detail
-
wait
public static void wait(int timeout)
Pauses the script execution for the specified timeout.- Parameters:
timeout- The time to wait in milliseconds.
-
wait
public static void wait(int minTimeout, int maxTimeout)Pauses the script execution for a random timeout within the specified range.- Parameters:
minTimeout- The minimum time to wait in milliseconds.maxTimeout- The maximum time to wait in milliseconds.
-
until
public static boolean until(java.util.function.BooleanSupplier condition, int minInterval, int maxInterval, long timeout)Waits until a specified condition is met or a timeout occurs.- Parameters:
condition- The condition to check.minInterval- The minimum interval between checks.maxInterval- The maximum interval between checks.timeout- The timeout duration.- Returns:
- true if the condition is met before the timeout, false otherwise.
-
until
public static boolean until(java.util.function.BooleanSupplier condition, int minTimeout, int maxTimeout)Waits until a specified condition is met or a timeout occurs, using default interval values.- Parameters:
condition- The condition to check.minTimeout- The minimum timeout duration.maxTimeout- The maximum timeout duration.- Returns:
- true if the condition is met before the timeout, false otherwise.
-
untilMoving
public static boolean untilMoving(int minTimeout, int maxTimeout)Waits until the local PlayerRSActor.isMoving()or a timeout occurs.- Parameters:
minTimeout- The minimum timeout duration.maxTimeout- The maximum timeout duration.- Returns:
- true if the player or NPC is moving before the timeout, false otherwise.
-
untilMoving
public static boolean untilMoving(RSActor rsa, int minTimeout, int maxTimeout)
Waits until the specified ActorRSActor.isMoving()or a timeout occurs.- Parameters:
rsa- The actor to reference.minTimeout- The minimum timeout duration.maxTimeout- The maximum timeout duration.- Returns:
- true if the player or NPC isMoving() before the timeout, false otherwise.
-
whileMoving
public static boolean whileMoving(int minTimeout, int maxTimeout)Waits while the local PlayerRSActor.isMoving()or a timeout occurs.- Parameters:
minTimeout- The minimum timeout duration.maxTimeout- The maximum timeout duration.- Returns:
- true if the player or NPC is moving before the timeout, false otherwise.
-
whileMoving
public static boolean whileMoving(RSActor rsa, int minTimeout, int maxTimeout)
Waits while the specified ActorRSActor.isMoving()or a timeout occurs.- Parameters:
rsa- The actor to reference.minTimeout- The minimum timeout duration.maxTimeout- The maximum timeout duration.- Returns:
- true if the player or NPC is moving before the timeout, false otherwise.
-
untilInteracting
public static boolean untilInteracting(int minTimeout, int maxTimeout)Waits until the local PlayerRSActor.isInteracting()or a timeout occurs.- Parameters:
minTimeout- The minimum timeout duration.maxTimeout- The maximum timeout duration.- Returns:
- true if the player or NPC is moving before the timeout, false otherwise.
-
untilInteracting
public static boolean untilInteracting(RSActor rsa, int minTimeout, int maxTimeout)
Waits until the specified ActorRSActor.isInteracting()or a timeout occurs.- Parameters:
rsa- The actor to reference.minTimeout- The minimum timeout duration.maxTimeout- The maximum timeout duration.- Returns:
- true if the player or NPC is moving before the timeout, false otherwise.
-
whileInteracting
public static boolean whileInteracting(int minTimeout, int maxTimeout)Waits while the local PlayerRSActor.isInteracting()or a timeout occurs.- Parameters:
minTimeout- The minimum timeout duration.maxTimeout- The maximum timeout duration.- Returns:
- true if the player or NPC is moving before the timeout, false otherwise.
-
whileInteracting
public static boolean whileInteracting(RSActor rsa, int minTimeout, int maxTimeout)
Waits while the specified ActorRSActor.isInteracting()or a timeout occurs.- Parameters:
rsa- The actor to reference.minTimeout- The minimum timeout duration.maxTimeout- The maximum timeout duration.- Returns:
- true if the player or NPC is moving before the timeout, false otherwise.
-
untilAnimating
public static boolean untilAnimating(int minTimeout, int maxTimeout)Waits until the local Player is animating, where "animating" is defined by theRSActor.getAnimation()!= -1, or a timeout occurs.- Parameters:
minTimeout- The minimum timeout duration.maxTimeout- The maximum timeout duration.- Returns:
- true if the actor starts playing an animation before the timeout, false otherwise.
-
untilAnimating
public static boolean untilAnimating(RSActor rsa, int minTimeout, int maxTimeout)
Waits until the specified actor is animating, where "animating" is defined by theRSActor.getAnimation()!= -1, or a timeout occurs.- Parameters:
rsa- The actor to reference.minTimeout- The minimum timeout duration.maxTimeout- The maximum timeout duration.- Returns:
- true if the actor starts playing an animation before the timeout, false otherwise.
-
whileAnimating
public static boolean whileAnimating(int minTimeout, int maxTimeout)Waits while the local Player is animating, where "animating" is defined by theRSActor.getAnimation()!= -1, or a timeout occurs.- Parameters:
minTimeout- The minimum timeout duration.maxTimeout- The maximum timeout duration.- Returns:
- true if the player is not playing an animation before the timeout, false otherwise.
-
whileAnimating
public static boolean whileAnimating(RSActor rsa, int minTimeout, int maxTimeout)
Waits while the specified actor is animating, where "animating" is defined by theRSActor.getAnimation()!= -1, or a timeout occurs.- Parameters:
rsa- The actor to reference.minTimeout- The minimum timeout duration.maxTimeout- The maximum timeout duration.- Returns:
- true if the actor is not playing an animation before the timeout, false otherwise.
-
untilIdle
public static boolean untilIdle(int idleLimit, int minTimeout, int maxTimeout)Waits until the local player becomes idle, where "idle" is defined by theRSActor.getAnimation()== -1, until a specified number of idle checks are met or a timeout occurs.- Parameters:
idleLimit- The number of idle checks required.minTimeout- The minimum timeout duration.maxTimeout- The maximum timeout duration.- Returns:
- true if the actor becomes idle before the timeout, false otherwise.
-
untilIdle
public static boolean untilIdle(RSActor rsa, int idleLimit, int minTimeout, int maxTimeout)
Waits until the specified actor becomes idle, where "idle" is defined by theRSActor.getAnimation()== -1, until a specified number of idle checks are met or a timeout occurs.- Parameters:
rsa- The actor to reference.idleLimit- The number of idle checks required.minTimeout- The minimum timeout duration.maxTimeout- The maximum timeout duration.- Returns:
- true if the actor becomes idle before the timeout, false otherwise.
-
untilBankIsOpen
public static boolean untilBankIsOpen(int minTimeout, int maxTimeout)Waits untilBank.isOpen()or a timeout occurs.- Parameters:
minTimeout- The minimum timeout duration.maxTimeout- The maximum timeout duration.- Returns:
- true if the bank interface is open before the timeout, false otherwise.
-
whileBankIsOpen
public static boolean whileBankIsOpen(int minTimeout, int maxTimeout)Waits whileBank.isOpen()or a timeout occurs.- Parameters:
minTimeout- The minimum timeout duration.maxTimeout- The maximum timeout duration.- Returns:
- true if the bank interface is open before the timeout, false otherwise.
-
untilShopIsOpen
public static boolean untilShopIsOpen(int minTimeout, int maxTimeout)Waits untilShop.isOpen()or a timeout occurs.- Parameters:
minTimeout- The minimum timeout duration.maxTimeout- The maximum timeout duration.- Returns:
- true if the shop interface is open before the timeout, false otherwise.
-
whileShopIsOpen
public static boolean whileShopIsOpen(int minTimeout, int maxTimeout)Waits whileShop.isOpen()or a timeout occurs.- Parameters:
minTimeout- The minimum timeout duration.maxTimeout- The maximum timeout duration.- Returns:
- true if the shop interface is open before the timeout, false otherwise.
-
ticks
public static void ticks(int amount)
Waits for the provided amount of Game ticks to occur.
-
-