#Requires AutoHotkey v2.0 #SingleInstance #MaxThreadsPerHotkey 2 ; Allows second press of F6 to interrupt/stop the loop active := false $F6:: { global active if(active == false){ WinWaitActive("CavesOfQud") active := true sleep 1000 FillMap.call() } else{ active := false } } $F7:: { Pause(-1) } ThrowBullet(){ command_speed := 75 ; Speed of sending commands to trigger the thro throw_speed := 125 ; Delay after throwing ; Open throw menu Send "{T}" Sleep command_speed ; Finalize the throw Send "{T}" Sleep command_speed ;Confirm aim at self Send "{Enter}" Sleep throw_speed } LateralMove(row_direction){ lateral_speed := 75 ; Speed of lateral movement ; Move in the current direction (right or left) if (row_direction == 1) { Send "{right}" } else { Send "{left}" } Sleep lateral_speed } VerticalMove(){ vertical_speed := 75 Send "{Down}" Sleep vertical_speed } FillRow(row_length, row_direction){ global active Loop row_length { ; Pause while game is not active window while(!WinActive("CavesOfQud")){ Sleep 200 } if(active){ ThrowBullet.call() LateralMove(row_direction) } else{ break } } ThrowBullet.call() } FillMap(){ row_length := 80 ; Length of a single row row_count := 25 ; Total number of rows row_direction := 1 ; 1 = right, -1 = left global active Loop row_count-1 { if(active){ ; Fill a single row in the current direction FillRow.call(row_length, row_direction) VerticalMove.call() row_direction := -row_direction } else{ break } } }