Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Resolved ExecutionDelay

Hey look! It's That Guy!
Joined
Sep 5, 2017
Messages
14
Was just wondering if i should use ExecutionDelay or make the bot without them as i have experienced that they are not reliable or just make the bot slow down.
And if i should use them, can somebody explain how exactly they work. I get that they delays until the statement is true, but does the timing you specified make the current loop run"Like if statement" or the whole loop your bots running.
 
Client Developer
Joined
Oct 12, 2015
Messages
3,765
If they're slowing your bot down then you're misusing them, and yes they should be used.

Execution.delayUntil(Callable<Boolean> condition, Callable<Boolean> resetCondition, int minDelay, int maxDelay) essentially just delays for a random period of time between minDelay and maxDelay, or until condition.call() returns true - resetCondition.call() returning true will result in the delay resetting. Let's take the example of opening the bank:

final Player local = Players.getLocal();
final LocatableEntity banker = Banks.newQuery().nearest();
if(local != null && banker != null && banker.interact("Bank")) {
Execution.delayUntil(() -> Bank.isOpen(), () -> local.isMoving, 1200, 1800);
}

1. Fetch the local player
2. Locate a banker
3. Perform the necessary null checks and interact with the banker
4. Delay:
  1. If the bank is open, exit the delayUntil statement
  2. Otherwise, if the local player is moving, reset the delay timer
  3. If the local player isn't moving, check if the random number generated between 1200 and 1800 has been exceeded, if it has then exit and return false, if it hasn't, return to step 4.1.
If any of the safety checks or the interaction in step 3 fail, the delay won't happen.
 
Conelander
Joined
Oct 30, 2014
Messages
3,517
If anything, they should speed up your bot by potentially massive amounts. You can make your bot interact with things at the perfect timings.
 
Hey look! It's That Guy!
Joined
Sep 5, 2017
Messages
14
If they're slowing your bot down then you're misusing them, and yes they should be used.

Execution.delayUntil(Callable<Boolean> condition, Callable<Boolean> resetCondition, int minDelay, int maxDelay) essentially just delays for a random period of time between minDelay and maxDelay, or until condition.call() returns true - resetCondition.call() returning true will result in the delay resetting. Let's take the example of opening the bank:



1. Fetch the local player
2. Locate a banker
3. Perform the necessary null checks and interact with the banker
4. Delay:
  1. If the bank is open, exit the delayUntil statement
  2. Otherwise, if the local player is moving, reset the delay timer
  3. If the local player isn't moving, check if the random number generated between 1200 and 1800 has been exceeded, if it has then exit and return false, if it hasn't, return to step 4.1.
If any of the safety checks or the interaction in step 3 fail, the delay won't happen.
Thank you. This helps me allot.
 
Top