• Log in or sign up for an account here: https://www.sythe.org/login

How to add random wait times properly:

Govind

The One Musketeer

Highly Respected
Mudkips
Retired Administrator
Joined
Apr 22, 2005
Sythe Gold
23
Messages
7,825
Le Monkey
Potamus
Prove it!
Sythe Awards 2011 Winner
Tier 1 Prizebox
Tortoise Penis
Trole
UWotM8?
Wait, do you not have an Archer rank?
In C++[Win32]:
Code:
#include <windows.h>
#include <stdlib.h>
void RandWait(DWORD nMinSleepTime, DWORD nMaxSleepTime)
{
    srand(GetTickCount());
    Sleep((rand()%nMaxSleepTime-nMinSleepTime)+nMinSleepTime);
}

VB6:
Code:
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliSeconds As Long)

Private Sub RandWait(Min As Long, Max As Long)
Randomize GetTickCount
Sleep Int(Rnd * (Max - Min)) + Min
End Sub
C#:
Code:
	[DllImport("kernel32.dll")]
		public static extern void Sleep(int dwMilliSeconds);
		static void RandWait(int min, int max)
		{
			Random RandomClass = new Random();
			int RandomNumber = RandomClass.Next();
			Sleep((RandomNumber%(max-min))+min);
		}

This is virtually the same thing I used for my autoclicker.
 
Runescape Gamblingrunescape gambling
Back
Top