BioBreak

Post gaming related scripts
User avatar
Grendahl
Posts: 170
Joined: 30 Sep 2013, 08:21

BioBreak

27 Sep 2016, 07:32

Figured I'd throw this out there for those who want to have their bots behave a bit more like a human. Most people don't sit at the keyboard and mash keys on a game 24/7, so this little example shows you how to allow your bot to take breaks.

Right now the times are set intentionally low so you can see how it works.

Code: Select all

#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
#SingleInstance Force
SetFormat, float, 0.0


MinPlayTime := 10000
MaxPlayTime := 20000
MinBioTime	:= 3000
MaxBioTime	:= 5000


Play:
	PlayTime := Rnd(MinPlayTime, MaxPlayTime)
	SetTimer, BioBreak, %PlayTime%
	PlayTimeSeconds := (PlayTime/1000)
	MsgBox,,,Playing for %PlayTimeSeconds% seconds,2
	Loop
		ToolTip Playing
Return
	
BioBreak:
	SetTimer, BioBreak, Off
	BioTime := Rnd(MinBioTime, MaxBioTime)
	BioTimeSeconds := (BioTime/1000)
	MsgBox,,,BioBreak for %BioTimeSeconds% seconds,2
	ToolTip BioBreak
	Sleep %BioTime%
	GoTo Play
Return


; FROM: http://www.autohotkey.com/forum/viewtopic.php?t=54713&postdays=0&postorder=asc&start=0
/* RANDOM FUNCTION
Rnd() ; - A random float between 0.0 and 1.0 (many uses)
Rnd(6) ; - A random integer between 1 and 6 (die roll)
Rnd("") ; - New random seed (selected randomly)
Rnd("", 12345) ; - New random seed (set explicitly)
Rnd(50, 100) ; - Random integer between 50 and 100 (typical use)
*/
Rnd(a=0.0,b=1) {
   IfEqual,a,,Random,,% r := b = 1 ? Rnd(0,0xFFFFFFFF) : b ;%
   Else Random,r,a,b
   Return r
}

*$Esc:: ExitApp
!$p:: Pause  ; Alt+P
Pause:: Pause
F12:: Reload
F11:: ListVars


Return to “Gaming Scripts (v1)”

Who is online

Users browsing this forum: No registered users and 71 guests