LmeSzinc / AzurLaneAutoScript

Azur Lane bot (CN/EN/JP/TW) 碧蓝航线脚本 | 无缝委托科研,全自动大世界
https://alas.azurlane.cloud
GNU General Public License v3.0
6.72k stars 792 forks source link

大世界进入港口时出现错误 #2728

Open Ashe428 opened 1 year ago

Ashe428 commented 1 year ago

在提问之前...

描述你的问题

进入港口时(各港口都有概率),有几率出现错误。

顺便说一下,自从bsm的更新以后,alas在自律扫完图后就有一定概率会出现卡着不动的情况。此时没有任何报错,log也一切正常,但就是不进行下一步。手动停止然后启动后恢复正常运行。

如何复现

正常运行alas有几率出现这种错误。个人猜测当第一舰队被其他三支舰队呈“T”字形包围时出错的概率更高,不一定准确。

预期行为

进入港口后,alas继续运行相关功能

相关 Logs

═══════════════════════════════════════ OS PORT DAILY ════════════════════════════════════════
INFO     12:19:27.399 │ OS PORT DAILY                                                         
──────────────────────────────── OS PORT DAILY IN [0|NY CITY] ────────────────────────────────
INFO     12:19:27.401 │ OS PORT DAILY IN [0|NY CITY]                                          
INFO     12:19:27.402 │ <<< GLOBE GOTO: [0|NY CITY] >>>                                       
INFO     12:19:27.403 │ Already at target zone                                                
INFO     12:19:27.454 │ Port route at [1 2]                                                   
INFO     12:19:27.462 │ [homo_storage] ((10, 7), [(110.307, 103.657), (1012.311, 103.657),    
         (-32.959, 600.567), (1113.057, 600.567)])                                            
INFO     12:19:27.579 │            tile_center: 0.942 (good match)                            
INFO     12:19:27.595 │ 0.100s  _   edge_lines: 1 hori, 1 vert                                
INFO     12:19:27.596 │ Edges:   \   homo_loca: ( 92,  58)                                    
INFO     12:19:27.601 │            center_loca: (5, 3)                                        
INFO     12:19:27.639 │ 0.037s         predict: 37                                            
INFO     12:19:27.641 │ -- -- -- -- -- --                                                     
INFO     12:19:27.642 │ -- -- -- -- -- --                                                     
INFO     12:19:27.643 │ .. -- -- -- -- --                                                     
INFO     12:19:27.644 │ .. -- -- -- -- FL                                                     
INFO     12:19:27.645 │ .. -- -- -- -- --                                                     
INFO     12:19:27.646 │ .. -- -- -- -- --                                                     
INFO     12:19:27.647 │ .. -- -- -- -- --                                                     
WARNING  12:19:27.648 │ Convert radar to local, but target grid not in local view. Assuming   
         camera center is current fleet: F4                                                   
ERROR    12:19:27.650 │ KeyError: (6, 5)                                                      
         ╭──────────────────────── Traceback (most recent call last) ────────────────────────╮
         │                                                                                   │
         │ C:\Users\Monix\Desktop\AzurLaneAutoScript\module\os\camera.py:150 in              │
         │ convert_radar_to_local                                                            │
         │                                                                                   │
         │   148 │   │                                                                       │
         │   149 │   │   try:                                                                │
         │ ❱ 150 │   │   │   local = self.view[np.add(location, center)]                     │
         │   151 │   │   except KeyError:                                                    │
         │   152 │   │   │   logger.warning(f'Convert radar to local, but target grid not in │
         │       '                                                                           │
         │                                                                                   │
         │ ╭─────────────────────────────────── locals ────────────────────────────────────╮ │
         │ │   center = (5, 3)                                                             │ │
         │ │   fleets = <module.map.map_grids.SelectedGrids object at 0x0000016A0557DB48>  │ │
         │ │ location = (1, 2)                                                             │ │
         │ │     self = <module.os.operation_siren.OperationSiren object at                │ │
         │ │            0x0000016A0397DA08>                                                │ │
         │ ╰───────────────────────────────────────────────────────────────────────────────╯ │
         │ C:\Users\Monix\Desktop\AzurLaneAutoScript\module\map_detection\view.py:36 in      │
         │ __getitem__                                                                       │
         │                                                                                   │
         │    34 │                                                                           │
         │    35 │   def __getitem__(self, item):                                            │
         │ ❱  36 │   │   return self.grids[tuple(item)]                                      │
         │    37 │                                                                           │
         │    38 │   def __contains__(self, item):                                           │
         │                                                                                   │
         │ ╭─────────────────────────────── locals ───────────────────────────────╮          │
         │ │ item = array([6, 5])                                                 │          │
         │ │ self = <module.map_detection.view.View object at 0x0000016A02E8C688> │          │
         │ ╰──────────────────────────────────────────────────────────────────────╯          │
         ╰───────────────────────────────────────────────────────────────────────────────────╯
         KeyError: (6, 5)                                                                     

         During handling of the above exception, another exception occurred:                  

         ╭──────────────────────── Traceback (most recent call last) ────────────────────────╮
         │                                                                                   │
         │ C:\Users\Monix\Desktop\AzurLaneAutoScript\alas.py:68 in run                       │
         │                                                                                   │
         │    66 │   │   try:                                                                │
         │    67 │   │   │   self.device.screenshot()                                        │
         │ ❱  68 │   │   │   self.__getattribute__(command)()                                │
         │    69 │   │   │   return True                                                     │
         │    70 │   │   except TaskEnd:                                                     │
         │                                                                                   │
         │ ╭───────────────────────────── locals ─────────────────────────────╮              │
         │ │ command = 'opsi_shop'                                            │              │
         │ │       e = KeyError((6, 5))                                       │              │
         │ │    self = <alas.AzurLaneAutoScript object at 0x0000016A3A92E188> │              │
         │ ╰──────────────────────────────────────────────────────────────────╯              │
         │ C:\Users\Monix\Desktop\AzurLaneAutoScript\alas.py:294 in opsi_shop                │
         │                                                                                   │
         │   292 │   def opsi_shop(self):                                                    │
         │   293 │   │   from module.campaign.os_run import OSCampaignRun                    │
         │ ❱ 294 │   │   OSCampaignRun(config=self.config, device=self.device).opsi_shop()   │
         │   295 │                                                                           │
         │   296 │   def opsi_voucher(self):                                                 │
         │                                                                                   │
         │ ╭──────────────────────────────── locals ────────────────────────────────╮        │
         │ │ OSCampaignRun = <class 'module.campaign.os_run.OSCampaignRun'>         │        │
         │ │          self = <alas.AzurLaneAutoScript object at 0x0000016A3A92E188> │        │
         │ ╰────────────────────────────────────────────────────────────────────────╯        │
         │                                                                                   │
         │ C:\Users\Monix\Desktop\AzurLaneAutoScript\module\campaign\os_run.py:34 in         │
         │ opsi_shop                                                                         │
         │                                                                                   │
         │    32 │   │   try:                                                                │
         │    33 │   │   │   self.load_campaign()                                            │
         │ ❱  34 │   │   │   self.campaign.os_shop()                                         │
         │    35 │   │   except ActionPointLimit:                                            │
         │    36 │   │   │   self.config.opsi_task_delay(ap_limit=True)                      │
         │                                                                                   │
         │ ╭────────────────────────────────── locals ──────────────────────────────────╮    │
         │ │ self = <module.campaign.os_run.OSCampaignRun object at 0x0000016A02967488> │    │
         │ ╰────────────────────────────────────────────────────────────────────────────╯    │
         │                                                                                   │
         │ C:\Users\Monix\Desktop\AzurLaneAutoScript\module\os\operation_siren.py:265 in     │
         │ os_shop                                                                           │
         │                                                                                   │
         │   263 │                                                                           │
         │   264 │   def os_shop(self):                                                      │
         │ ❱ 265 │   │   self.os_port_daily(supply=self.config.OpsiShop_BuySupply)           │
         │   266 │   │   self.config.task_delay(server_update=True)                          │
         │   267                                                                             │
         │                                                                                   │
         │ ╭─────────────────────────────────── locals ────────────────────────────────────╮ │
         │ │ self = <module.os.operation_siren.OperationSiren object at                    │ │
         │ │        0x0000016A0397DA08>                                                    │ │
         │ ╰───────────────────────────────────────────────────────────────────────────────╯ │
         │                                                                                   │
         │ C:\Users\Monix\Desktop\AzurLaneAutoScript\module\os\operation_siren.py:45 in      │
         │ os_port_daily                                                                     │
         │                                                                                   │
         │    43 │   │   │   logger.hr(f'OS port daily in {port}', level=2)                  │
         │    44 │   │   │   self.globe_goto(port)                                           │
         │ ❱  45 │   │   │   self.port_goto()                                                │
         │    46 │   │   │   self.port_enter()                                               │
         │    47 │   │   │   # Deprecated since 2022.01.13, missions are shown only in overv │
         │       longer to be shown at ports.                                                │
         │                                                                                   │
         │ ╭─────────────────────────────────── locals ────────────────────────────────────╮ │
         │ │ mission_success = True                                                        │ │
         │ │            port = [0|NY City]                                                 │ │
         │ │           ports = ['NY City', 'Gibraltar', 'Liverpool', 'St. Petersburg']     │ │
         │ │            self = <module.os.operation_siren.OperationSiren object at         │ │
         │ │                   0x0000016A0397DA08>                                         │ │
         │ │          supply = True                                                        │ │
         │ │  supply_success = True                                                        │ │
         │ ╰───────────────────────────────────────────────────────────────────────────────╯ │
         │                                                                                   │
         │ C:\Users\Monix\Desktop\AzurLaneAutoScript\module\os\map.py:185 in port_goto       │
         │                                                                                   │
         │   183 │   │   for _ in range(3):                                                  │
         │   184 │   │   │   try:                                                            │
         │ ❱ 185 │   │   │   │   super().port_goto()                                         │
         │   186 │   │   │   │   return True                                                 │
         │   187 │   │   │   except MapWalkError:                                            │
         │                                                                                   │
         │ ╭─────────────────────────────────── locals ────────────────────────────────────╮ │
         │ │ __class__ = <class 'module.os.map.OSMap'>                                     │ │
         │ │         _ = 0                                                                 │ │
         │ │      self = <module.os.operation_siren.OperationSiren object at               │ │
         │ │             0x0000016A0397DA08>                                               │ │
         │ ╰───────────────────────────────────────────────────────────────────────────────╯ │
         │                                                                                   │
         │ C:\Users\Monix\Desktop\AzurLaneAutoScript\module\os\fleet.py:433 in port_goto     │
         │                                                                                   │
         │   431 │   │   │   # Click way point                                               │
         │   432 │   │   │   grid = point_limit(grid, area=(-4, -2, 3, 2))                   │
         │ ❱ 433 │   │   │   grid = self.convert_radar_to_local(grid)                        │
         │   434 │   │   │   self.device.click(grid)                                         │
         │   435                                                                             │
         │                                                                                   │
         │ ╭─────────────────────────────────── locals ────────────────────────────────────╮ │
         │ │ confirm_timer = Timer(limit=0.221/3, count=0/6)                               │ │
         │ │          grid = (1, 2)                                                        │ │
         │ │   port_arrive = False                                                         │ │
         │ │  radar_arrive = False                                                         │ │
         │ │          self = <module.os.operation_siren.OperationSiren object at           │ │
         │ │                 0x0000016A0397DA08>                                           │ │
         │ ╰───────────────────────────────────────────────────────────────────────────────╯ │
         │                                                                                   │
         │ C:\Users\Monix\Desktop\AzurLaneAutoScript\module\os\camera.py:155 in              │
         │ convert_radar_to_local                                                            │
         │                                                                                   │
         │   153 │   │   │   │   │   │      f'Assuming camera center is current fleet:       │
         │       {location2node(self.view.center_loca)}')                                    │
         │   154 │   │   │   center = self.view.center_loca                                  │
         │ ❱ 155 │   │   │   local = self.view[np.add(location, center)]                     │
         │   156 │   │                                                                       │
         │   157 │   │   logger.info('Radar %s -> Local %s (fleet=%s)' % (                   │
         │                                                                                   │
         │ ╭─────────────────────────────────── locals ────────────────────────────────────╮ │
         │ │   center = (5, 3)                                                             │ │
         │ │   fleets = <module.map.map_grids.SelectedGrids object at 0x0000016A0557DB48>  │ │
         │ │ location = (1, 2)                                                             │ │
         │ │     self = <module.os.operation_siren.OperationSiren object at                │ │
         │ │            0x0000016A0397DA08>                                                │ │
         │ ╰───────────────────────────────────────────────────────────────────────────────╯ │
         │                                                                                   │
         │ C:\Users\Monix\Desktop\AzurLaneAutoScript\module\map_detection\view.py:36 in      │
         │ __getitem__                                                                       │
         │                                                                                   │
         │    34 │                                                                           │
         │    35 │   def __getitem__(self, item):                                            │
         │ ❱  36 │   │   return self.grids[tuple(item)]                                      │
         │    37 │                                                                           │
         │    38 │   def __contains__(self, item):                                           │
         │                                                                                   │
         │ ╭─────────────────────────────── locals ───────────────────────────────╮          │
         │ │ item = array([6, 5])                                                 │          │
         │ │ self = <module.map_detection.view.View object at 0x0000016A02E8C688> │          │
         │ ╰──────────────────────────────────────────────────────────────────────╯          │
         ╰───────────────────────────────────────────────────────────────────────────────────╯
         KeyError: (6, 5)

截图

Screenshot_2023 06 07_15 04 29 621

还有别的吗?

No response

Ashe428 commented 1 year ago

平均两天就会出现一次,是我阵容的问题吗? log.zip