Jump to content

Macro insert random delay


Recommended Posts

Hello,

So far I've been able to figure out profile and fight class creation but I'm stuck with a core function for my bot.

It's going to rely on the use of an in game macro. What I need is to have a random delay on said macro between x and y seconds. 
Preferably I can run another function with this also, essentially having combat and pathing handled by the bot with two macros for targeting a special mob and running this function.

Any idea's/advice?

Link to comment
Share on other sites

Some advice would be really appreciated even if it was "you can do this via x" -> Point me in the direction and I'll research the how. What I don't know is the unknown at the moment.

 

Link to comment
Share on other sites

 private void foo()
 {
   
     var tmp = calculateRandomByRange(1000, 3000);
     //sleep for random between 1000 and 3000
     Thread.sleep(tmp);
     // run macros
       macro():
     
 }
  
  private int calculateRandomByRange(int lower, int upper)
    {
        Random r = new Random();
        return (r.Next(lower, upper));
    }

Here is how you do a random sleep between 1000 and 3000 milliseconds in C#. 

Edited by Avvi
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...