Package com.runemate.game.api.script
Class Execution
- java.lang.Object
-
- com.runemate.game.api.script.Execution
-
public final class Execution extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
delay(int minLength, int maxLength)
Delays the current thread's execution for a length of time given in milliseconds between the minimum and maximum lengthstatic boolean
delay(int minLength, int maxLength, int averageLength)
Delays the current thread's execution for a length of time between the minimum and maximum length, averaging around the averageLengthstatic boolean
delay(long length)
Delays the current thread's execution for the specified length of time in millisecondsstatic boolean
delay(long minLength, long maxLength)
Delays the current thread's execution for a length of time given in milliseconds between the minimum and maximum lengthstatic boolean
delay(long minLength, long maxLength, long averageLength)
Delays the current thread's execution for a length of time between the minimum and maximum length, averaging around the averageLengthstatic void
delayUntil(java.util.concurrent.Callable<java.lang.Boolean> condition)
Delays until condition returns true.static boolean
delayUntil(java.util.concurrent.Callable<java.lang.Boolean> condition, int timeout)
Delays execution of the current thread until the condition is met (returns true) The current result will be checked every Math.min(100, timeout / 20) milliseconds (frequency) until the condition is met or the timeout is reachedstatic boolean
delayUntil(java.util.concurrent.Callable<java.lang.Boolean> condition, int minTimeout, int maxTimeout)
static boolean
delayUntil(java.util.concurrent.Callable<java.lang.Boolean> condition, java.util.concurrent.Callable<java.lang.Boolean> reset, int timeout)
static boolean
delayUntil(java.util.concurrent.Callable<java.lang.Boolean> condition, java.util.concurrent.Callable<java.lang.Boolean> reset, int minTimeout, int maxTimeout)
static boolean
delayUntil(java.util.concurrent.Callable<java.lang.Boolean> condition, java.util.concurrent.Callable<java.lang.Boolean> reset, int frequency, int minTimeout, int maxTimeout)
Delays execution of the current thread until the condition is met (returns true) The current result will be checked every X milliseconds (frequency) until the condition is met or the timeout is reached.static void
delayUntilCycle(int targetEngineCycle)
static void
delayWhile(java.util.concurrent.Callable<java.lang.Boolean> condition)
Delays while condition returns true.static boolean
delayWhile(java.util.concurrent.Callable<java.lang.Boolean> condition, int timeout)
static boolean
delayWhile(java.util.concurrent.Callable<java.lang.Boolean> condition, int minTimeout, int maxTimeout)
static boolean
delayWhile(java.util.concurrent.Callable<java.lang.Boolean> condition, java.util.concurrent.Callable<java.lang.Boolean> reset, int timeout)
static boolean
delayWhile(java.util.concurrent.Callable<java.lang.Boolean> condition, java.util.concurrent.Callable<java.lang.Boolean> reset, int minTimeout, int maxTimeout)
static boolean
delayWhile(java.util.concurrent.Callable<java.lang.Boolean> condition, java.util.concurrent.Callable<java.lang.Boolean> reset, int frequency, int minTimeout, int maxTimeout)
Delays execution of the current thread while the condition is met (returns true) The current result will be checked every X milliseconds (frequency) until the condition is met or the timeout is reached.
-
-
-
Method Detail
-
delay
public static boolean delay(long length)
Delays the current thread's execution for the specified length of time in milliseconds- Parameters:
length
- The length of time to delay in milliseconds- Returns:
- Whether we slept for the correct amount of time
-
delay
public static boolean delay(int minLength, int maxLength)
Delays the current thread's execution for a length of time given in milliseconds between the minimum and maximum length- Parameters:
minLength
- The minimum length in milliseconds (Inclusive)maxLength
- The maximum length in milliseconds (Inclusive)
-
delay
public static boolean delay(int minLength, int maxLength, int averageLength)
Delays the current thread's execution for a length of time between the minimum and maximum length, averaging around the averageLength- Parameters:
minLength
- The minimum length in milliseconds (Inclusive)maxLength
- The maximum length in milliseconds (Inclusive)averageLength
- The average length of time in milliseconds to delay execution
-
delay
public static boolean delay(long minLength, long maxLength)
Delays the current thread's execution for a length of time given in milliseconds between the minimum and maximum length- Parameters:
minLength
- The minimum length in milliseconds (Inclusive)maxLength
- The maximum length in milliseconds (Inclusive)
-
delay
public static boolean delay(long minLength, long maxLength, long averageLength)
Delays the current thread's execution for a length of time between the minimum and maximum length, averaging around the averageLength- Parameters:
minLength
- The minimum length in milliseconds (Inclusive)maxLength
- The maximum length in milliseconds (Inclusive)averageLength
- The average length of time in milliseconds to delay execution
-
delayUntil
public static void delayUntil(java.util.concurrent.Callable<java.lang.Boolean> condition)
Delays until condition returns true. Usage of this method is discouraged to the same extent as while loops. The advantage of this over a while loop is that it takes small pauses between calls to reduce cpu load.- Parameters:
condition
-
-
delayUntil
public static boolean delayUntil(java.util.concurrent.Callable<java.lang.Boolean> condition, int timeout)
Delays execution of the current thread until the condition is met (returns true) The current result will be checked every Math.min(100, timeout / 20) milliseconds (frequency) until the condition is met or the timeout is reached- Parameters:
condition
- The condition that the thread will wait ontimeout
- The maximum amount of time to delay in milliseconds
-
delayUntil
public static boolean delayUntil(java.util.concurrent.Callable<java.lang.Boolean> condition, int minTimeout, int maxTimeout)
-
delayUntil
public static boolean delayUntil(java.util.concurrent.Callable<java.lang.Boolean> condition, java.util.concurrent.Callable<java.lang.Boolean> reset, int timeout)
-
delayUntil
public static boolean delayUntil(java.util.concurrent.Callable<java.lang.Boolean> condition, java.util.concurrent.Callable<java.lang.Boolean> reset, int minTimeout, int maxTimeout)
-
delayUntil
public static boolean delayUntil(java.util.concurrent.Callable<java.lang.Boolean> condition, java.util.concurrent.Callable<java.lang.Boolean> reset, int frequency, int minTimeout, int maxTimeout)
Delays execution of the current thread until the condition is met (returns true) The current result will be checked every X milliseconds (frequency) until the condition is met or the timeout is reached.- Parameters:
condition
- The condition that the thread will wait onreset
- A condition that will be used to reset the current time to 0frequency
- The frequency that the condition is checked in millisecondsminTimeout
- The minimum length of time in milliseconds that can pass before the method times outmaxTimeout
- The maximum length of time in milliseconds that can pass before the method times out
-
delayUntilCycle
public static void delayUntilCycle(int targetEngineCycle)
-
delayWhile
public static void delayWhile(java.util.concurrent.Callable<java.lang.Boolean> condition)
Delays while condition returns true. Usage of this method is discouraged to the same extent as while loops. The advantage of this over a while loop is that it takes small pauses between calls to reduce cpu load.- Parameters:
condition
-
-
delayWhile
public static boolean delayWhile(java.util.concurrent.Callable<java.lang.Boolean> condition, int timeout)
-
delayWhile
public static boolean delayWhile(java.util.concurrent.Callable<java.lang.Boolean> condition, int minTimeout, int maxTimeout)
-
delayWhile
public static boolean delayWhile(java.util.concurrent.Callable<java.lang.Boolean> condition, java.util.concurrent.Callable<java.lang.Boolean> reset, int timeout)
-
delayWhile
public static boolean delayWhile(java.util.concurrent.Callable<java.lang.Boolean> condition, java.util.concurrent.Callable<java.lang.Boolean> reset, int minTimeout, int maxTimeout)
-
delayWhile
public static boolean delayWhile(java.util.concurrent.Callable<java.lang.Boolean> condition, java.util.concurrent.Callable<java.lang.Boolean> reset, int frequency, int minTimeout, int maxTimeout)
Delays execution of the current thread while the condition is met (returns true) The current result will be checked every X milliseconds (frequency) until the condition is met or the timeout is reached.- Parameters:
condition
- The condition that the thread will wait onreset
- A condition that will be used to reset the current time to 0frequency
- The frequency that the condition is checked in millisecondsminTimeout
- The minimum length of time in milliseconds that can pass before the method times outmaxTimeout
- The maximum length of time in milliseconds that can pass before the method times out
-
-