mirror of
https://github.com/bnowakow/GT7-Scripts.git
synced 2026-01-09 04:41:56 +00:00
PoC for timeout for turn detection
This commit is contained in:
@@ -22,9 +22,11 @@ TurnTolerance := 10
|
||||
|
||||
GoTo EndTurnDef
|
||||
|
||||
|
||||
CheckTurn(x,y, b_size := 2)
|
||||
CheckTurn(x,y, timeout := 3500, b_size := 2)
|
||||
{
|
||||
check_turn_start_tick_count := A_TickCount
|
||||
;ToolTipper("A_TickCount at the begining of CheckTurn " A_TickCount, 100, 150)
|
||||
|
||||
color_player := 0xDE6E70
|
||||
if (__enableTurn_mod__ = 0){
|
||||
return
|
||||
@@ -34,11 +36,21 @@ CheckTurn(x,y, b_size := 2)
|
||||
|
||||
loop {
|
||||
tc := BitGrab(x, y, b_size)
|
||||
|
||||
;ToolTipper("debug until loop")
|
||||
for i, c in tc
|
||||
{
|
||||
|
||||
|
||||
check_turn_now_tick_count := A_TickCount
|
||||
check_turn_tick_count_from_start_to_now := check_turn_now_tick_count - check_turn_start_tick_count
|
||||
if (check_turn_tick_count_from_start_to_now > timeout) {
|
||||
ToolTipper("Turn Check Timeout exceeded", 100, 200)
|
||||
return false
|
||||
}
|
||||
;ToolTipper("debug i loop")
|
||||
|
||||
td := Distance(c, color_player)
|
||||
ToolTipper("Turn" td)
|
||||
; ToolTipper("Turn" td)
|
||||
if (td < 20 ){
|
||||
turn_complete := true
|
||||
|
||||
@@ -46,10 +58,20 @@ CheckTurn(x,y, b_size := 2)
|
||||
}
|
||||
}
|
||||
|
||||
} until turn_complete = true
|
||||
ToolTipper("Turn Found")
|
||||
check_turn_now_tick_count := A_TickCount
|
||||
check_turn_tick_count_from_start_to_now := check_turn_now_tick_count - check_turn_start_tick_count
|
||||
if (check_turn_tick_count_from_start_to_now > timeout) {
|
||||
ToolTipper("Turn Check Timeout exceeded", 100, 200)
|
||||
return false
|
||||
}
|
||||
} until (turn_complete = true)
|
||||
check_turn_found_tick_count := A_TickCount
|
||||
check_turn_tick_count_from_start_to_found := check_turn_found_tick_count - check_turn_start_tick_count
|
||||
ToolTipper("tickCount from start to end " check_turn_tick_count_from_start_to_found, 100, 250)
|
||||
; Sleep, 100000 ; debug
|
||||
;ToolTipper("Turn Found")
|
||||
|
||||
return
|
||||
return true
|
||||
}
|
||||
|
||||
ResetTurn:
|
||||
|
||||
Reference in New Issue
Block a user