@@ -972,10 +972,6 @@ def speak_selected_menu_item(self):
972
972
def run (self ):
973
973
self .hang_activity_sender = self ._hang_monitor .register_component (thread_handle = self , hang_timeout_seconds = 10 )
974
974
while not self .stop_event .is_set ():
975
- if not self .parent .game_is_foreground :
976
- self .hang_activity_sender .notify_wait ()
977
- time .sleep (1 / settings .FPS )
978
- self .paused = True
979
975
try :
980
976
msg = self .incoming_frame_queue .get (timeout = 5 )
981
977
self .hang_activity_sender .notify_activity (HangAnnotation (data = {"data" : "window analyze" }))
@@ -1000,6 +996,9 @@ def run(self):
1000
996
# is it empty because stuff is shut down?
1001
997
if self .stop_event .is_set ():
1002
998
return
999
+ if self .paused :
1000
+ self .hang_activity_sender .notify_wait ()
1001
+ continue
1003
1002
1004
1003
# something is wrong
1005
1004
raise Exception ("No new full frame for 5 seconds" )
@@ -1009,7 +1008,7 @@ def run(self):
1009
1008
self .frame = np .asarray (shot )
1010
1009
cv2 .cvtColor (self .frame , cv2 .COLOR_BGRA2GRAY , dst = self .gray_frame )
1011
1010
1012
- if self .parent . game_is_foreground :
1011
+ if not self .paused :
1013
1012
self .ocr_screen ()
1014
1013
1015
1014
quests = extract_quest_name_from_quest_area (self .gray_frame )
@@ -1365,7 +1364,7 @@ def handle_new_frame(self, data: NewFrame):
1365
1364
self .grid_near_rect = Bot .default_grid_rect (self .parent .nearby_rect_mss )
1366
1365
1367
1366
self .was_match = False
1368
- if not self .parent . game_is_foreground :
1367
+ if self .paused :
1369
1368
return
1370
1369
1371
1370
realm_alignment = self .detect_what_realm_in ()
@@ -1412,9 +1411,13 @@ def run(self):
1412
1411
try :
1413
1412
msg : MessageImpl = self .nearby_queue .get (timeout = 5 )
1414
1413
except queue .Empty :
1415
- # something has gone wrong with getting timely frames
1416
- root .warning ("No nearby frame for 5 seconds" )
1417
- return
1414
+ if self .paused :
1415
+ self .hang_activity_sender .notify_wait ()
1416
+ pass
1417
+ else : # something has gone wrong with getting timely frames
1418
+ empty_text = "No nearby frame for 5 seconds"
1419
+ root .warning (empty_text )
1420
+ raise Exception (empty_text )
1418
1421
1419
1422
self .hang_activity_sender .notify_activity (HangAnnotation ({"event" : "near_frame_processing" }))
1420
1423
if msg is None :
0 commit comments