LmeSzinc / StarRailCopilot

崩坏:星穹铁道脚本 | Honkai: Star Rail auto bot (简体中文/繁體中文/English/Español)
GNU General Public License v3.0
3.19k stars 157 forks source link

_obtain_get_entry Error most of the time when running Dungeon #642

Open DrakeVG opened 1 month ago

DrakeVG commented 1 month ago

Before you asking

Describe the bug

This error has been happening a lot whenever it's farming Dungeon, specifically when running Calyx it activates the node then stay on the first screen with ScriptError: _obtain_get_entry: index and prev must be set together,
index=2, prev=None

To Reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

No response

Relevant log output

────────────────────────────────── DUNGEON ENTER ──────────────────────────────────
INFO     03:33:46.079 │ DUNGEON ENTER                                              
INFO     03:33:46.088 │ Click (1096,  534) @                                       
         DungeonList(Calyx_Crimson_Destruction_Herta_StorageZone)                  
INFO     03:33:50.417 │ [OcrDungeonList 3.233s] ['Enter', ' The Reverie            
         (Dreamscape', 'Bud of Harmony', 'Teleport', ' Robot Settlement', 'ction', 
         'Bud of Destruction', 'Teleport', ' Scalegorge Waterscape', 'Bud of       
         Destruction', 'Teleport', ' Storage Zone', 'vation']                      
INFO     03:33:50.425 │ [OcrDungeonList matched] [DungeonEntrance(Enter),          
         DungeonList(Calyx_Crimson_Harmony_Penacony_TheReverieDreamscape),         
         DungeonEntrance(Teleport),                                                
         DungeonList(Calyx_Crimson_Harmony_Jarilo_RobotSettlement),                
         DungeonEntrance(Teleport),                                                
         DungeonList(Calyx_Crimson_Destruction_Luofu_ScalegorgeWaterscape),        
         DungeonEntrance(Teleport),                                                
         DungeonList(Calyx_Crimson_Destruction_Herta_StorageZone)]                 
INFO     03:33:50.430 │ [DungeonList] 10 - 21                                      
WARNING  03:33:50.434 │ Early access dungeon:                                      
         DungeonList(Calyx_Crimson_Harmony_Penacony_TheReverieDreamscape)          
INFO     03:33:50.437 │ [DungeonList] 10 - 20                                      
INFO     03:33:50.441 │ Click (1115,  517) @                                       
         DungeonList(Calyx_Crimson_Destruction_Herta_StorageZone)                  
INFO     03:33:56.474 │ [OcrDungeonList 3.570s] ['Enter', ' The Reverie            
         (Dreamscape', 'Bud of Harmony', 'Teleport', ' Robot Settlement', 'ction', 
         'Bud of Destruction', 'Teleport', ' Scalegorge Waterscape', 'Bud of       
         Destruction', 'Teleport', ' Storage Zone', 'vation']                      
INFO     03:33:56.480 │ [OcrDungeonList matched] [DungeonEntrance(Enter),          
         DungeonList(Calyx_Crimson_Harmony_Penacony_TheReverieDreamscape),         
         DungeonEntrance(Teleport),                                                
         DungeonList(Calyx_Crimson_Harmony_Jarilo_RobotSettlement),                
         DungeonEntrance(Teleport),                                                
         DungeonList(Calyx_Crimson_Destruction_Luofu_ScalegorgeWaterscape),        
         DungeonEntrance(Teleport),                                                
         DungeonList(Calyx_Crimson_Destruction_Herta_StorageZone)]                 
INFO     03:33:56.485 │ [DungeonList] 10 - 21                                      
WARNING  03:33:56.487 │ Early access dungeon:                                      
         DungeonList(Calyx_Crimson_Harmony_Penacony_TheReverieDreamscape)          
INFO     03:33:56.489 │ [DungeonList] 10 - 20                                      
INFO     03:33:56.491 │ Click (1109,  523) @                                       
         DungeonList(Calyx_Crimson_Destruction_Herta_StorageZone)                  
INFO     03:34:09.212 │ Arrive COMBAT_PREPARE                                      
INFO     03:34:09.217 │ Combat enter from map                                      
INFO     03:34:09.665 │ At COMBAT_PREPARE                                          
───────────────────────────────────── COMBAT ──────────────────────────────────────
INFO     03:34:09.671 │ COMBAT                                                     
INFO     03:34:09.673 │ Combat, team=6, wave=0/0                                   
INFO     03:34:09.675 │ <<< COMBAT PREPARE >>>                                     
INFO     03:34:09.678 │ ['Feixiao', False]                                         
INFO     03:34:09.718 │ Planner item=ItemTrace(Worldbreaker_Blade)                 
         value=MultiValue(purple=42, blue=104, green=51)                           
         total=MultiValue(purple=154, blue=81, green=22)                           
         synthesize=MultiValue(purple=10, blue=9, green=0)                         
         time=datetime.datetime(2024, 10, 3, 22, 57, 56) progress=44.4 eta=6.8 come
         from DungeonList(Calyx_Crimson_Destruction_Herta_StorageZone)             
─────────────────────────────────── OBTAIN GET ────────────────────────────────────
INFO     03:34:09.722 │ OBTAIN GET                                                 
INFO     03:34:09.725 │ Find may obtain                                            
INFO     03:34:09.908 │ [trailblaze_exp] True                                      
INFO     03:34:09.910 │ Obtain enter OBTAIN_2                                      
INFO     03:34:09.926 │ Click ( 924,  432) @ OBTAIN_2                              
INFO     03:34:12.010 │ Click ( 923,  447) @ OBTAIN_2                              
INFO     03:34:14.402 │ [ITEM_NAME 0.352s] Worldbreaker BladeHwFnomer              
INFO     03:34:14.408 │ [ITEM_NAME matched] None                                   
INFO     03:34:14.671 │ [ITEM_AMOUNT] 42                                           
INFO     03:34:14.674 │ [ITEM_AMOUNT format] Currently 0wned:42 -> 42              
INFO     03:34:14.676 │ [ITEM_AMOUNT 0.265s] 42                                    
WARNING  03:34:14.678 │ _obtain_parse: Unknown item name                           
INFO     03:34:14.685 │ Obtain close                                               
INFO     03:34:14.691 │ Click (1054,  202) @ ITEM_CLOSE                            
INFO     03:34:15.629 │ [trailblaze_exp] True                                      
ERROR    03:34:15.633 │ ScriptError: _obtain_get_entry: index and prev must be set 
         together, index=2, prev=None                                              
         ╭────────────────── Traceback (most recent call last) ───────────────────╮
         │ D:\Games\StarRailCopilot\module\alas.py:79 in run                      │
         │                                                                        │
         │    77 │   │   │   self.device.screenshot()                             │
         │    78 │   │   │   self.device.screenshot_tracking.clear()              │
         │ ❱  79 │   │   │   self.__getattribute__(command)()                     │
         │    80 │   │   │   return True                                          │
         │    81 │   │   except TaskEnd:                                          │
         │                                                                        │
         │ ╭────────────────────────────── locals ──────────────────────────────╮ │
         │ │ command = 'dungeon'                                                │ │
         │ │       e = ScriptError('_obtain_get_entry: index and prev must be   │ │
         │ │           set together, index=2, prev=None')                       │ │
         │ │    self = <src.StarRailCopilot object at 0x0000022DD95D7D00>       │ │
         │ ╰────────────────────────────────────────────────────────────────────╯ │
         │                                                                        │
         │ D:\Games\StarRailCopilot\src.py:31 in dungeon                          │
         │                                                                        │
         │   29 │   def dungeon(self):                                            │
         │   30 │   │   from tasks.dungeon.dungeon import Dungeon                 │
         │ ❱ 31 │   │   Dungeon(config=self.config, device=self.device).run()     │
         │   32 │                                                                 │
         │   33 │   def weekly(self):                                             │
         │                                                                        │
         │ ╭─────────────────────────── locals ───────────────────────────╮       │
         │ │ Dungeon = <class 'tasks.dungeon.dungeon.Dungeon'>            │       │
         │ │    self = <src.StarRailCopilot object at 0x0000022DD95D7D00> │       │
         │ ╰──────────────────────────────────────────────────────────────╯       │
         │                                                                        │
         │ D:\Games\StarRailCopilot\tasks\dungeon\dungeon.py:340 in run           │
         │                                                                        │
         │   338 │   │   else:                                                    │
         │   339 │   │   │   # Combat                                             │
         │ ❱ 340 │   │   │   self.dungeon_run(final)                              │
         │   341 │   │   │   self.is_doing_planner = False                        │
         │   342 │   │   │   # Scheduler                                          │
         │                                                                        │
         │ ╭────────────────────────────── locals ──────────────────────────────╮ │
         │ │ do_rogue = False                                                   │ │
         │ │    final = DungeonList(Calyx_Crimson_Destruction_Herta_StorageZon… │ │
         │ │  planner = DungeonList(Calyx_Crimson_Destruction_Herta_StorageZon… │ │
         │ │     self = <tasks.dungeon.dungeon.Dungeon object at                │ │
         │ │            0x0000022DAAAE3A60>                                     │ │
         │ ╰────────────────────────────────────────────────────────────────────╯ │
         │                                                                        │
         │ D:\Games\StarRailCopilot\tasks\dungeon\dungeon.py:220 in dungeon_run   │
         │                                                                        │
         │   218 │   │   else:                                                    │
         │   219 │   │   │   # Normal run                                         │
         │ ❱ 220 │   │   │   return self._dungeon_run(dungeon=dungeon, team=team, │
         │   221 │   │   │   │   │   │   │   │   │    support_character=support_c │
         │   222                                                                  │
         │                                                                        │
         │ ╭────────────────────────────── locals ──────────────────────────────╮ │
         │ │           dungeon = DungeonList(Calyx_Crimson_Destruction_Herta_S… │ │
         │ │           require = False                                          │ │
         │ │              self = <tasks.dungeon.dungeon.Dungeon object at       │ │
         │ │                     0x0000022DAAAE3A60>                            │ │
         │ │ support_character = None                                           │ │
         │ │              team = None                                           │ │
         │ │        wave_limit = 0                                              │ │
         │ ╰────────────────────────────────────────────────────────────────────╯ │
         │                                                                        │
         │ D:\Games\StarRailCopilot\tasks\dungeon\dungeon.py:95 in _dungeon_run   │
         │                                                                        │
         │    93 │   │   # Combat                                                 │
         │    94 │   │   self.dungeon = dungeon                                   │
         │ ❱  95 │   │   count = self.combat(team=team, wave_limit=wave_limit,    │
         │       support_character=support_character)                             │
         │    96 │   │   self.dungeon = None                                      │
         │    97                                                                  │
         │                                                                        │
         │ ╭────────────────────────────── locals ──────────────────────────────╮ │
         │ │           dungeon = DungeonList(Calyx_Crimson_Destruction_Herta_S… │ │
         │ │          interact = None                                           │ │
         │ │              self = <tasks.dungeon.dungeon.Dungeon object at       │ │
         │ │                     0x0000022DAAAE3A60>                            │ │
         │ │    skip_ui_switch = False                                          │ │
         │ │ support_character = 'Feixiao'                                      │ │
         │ │              team = 6                                              │ │
         │ │        wave_limit = 0                                              │ │
         │ ╰────────────────────────────────────────────────────────────────────╯ │
         │                                                                        │
         │ D:\Games\StarRailCopilot\tasks\combat\combat.py:422 in combat          │
         │                                                                        │
         │   420 │   │   │   logger.info(f'Combat, team={team},                   │
         │       wave={self.combat_wave_done}/{self.combat_wave_limit}')          │
         │   421 │   │   │   # Prepare                                            │
         │ ❱ 422 │   │   │   prepare = self.combat_prepare(team, support_characte │
         │   423 │   │   │   if not prepare:                                      │
         │   424 │   │   │   │   self.combat_exit()                               │
         │                                                                        │
         │ ╭────────────────────────────── locals ──────────────────────────────╮ │
         │ │                  self = <tasks.dungeon.dungeon.Dungeon object at   │ │
         │ │                         0x0000022DAAAE3A60>                        │ │
         │ │ skip_first_screenshot = True                                       │ │
         │ │     support_character = 'Feixiao'                                  │ │
         │ │                  team = 6                                          │ │
         │ │            wave_limit = 0                                          │ │
         │ ╰────────────────────────────────────────────────────────────────────╯ │
         │                                                                        │
         │ D:\Games\StarRailCopilot\tasks\combat\combat.py:136 in combat_prepare  │
         │                                                                        │
         │   134 │   │   │   │   self.map_A_timer.reset()                         │
         │   135 │   │   │   if self.appear(COMBAT_PREPARE, interval=2):          │
         │ ❱ 136 │   │   │   │   if self.is_doing_planner and self.obtained_is_fu │
         │       wave_done=self.combat_wave_done):                                │
         │   137 │   │   │   │   │   # Update stamina so task can be delayed if b │
         │       stamina exhausted                                                │
         │   138 │   │   │   │   │   self.combat_get_trailblaze_power()           │
         │                                                                        │
         │ ╭────────────────────────────── locals ──────────────────────────────╮ │
         │ │                  self = <tasks.dungeon.dungeon.Dungeon object at   │ │
         │ │                         0x0000022DAAAE3A60>                        │ │
         │ │ skip_first_screenshot = False                                      │ │
         │ │     support_character = 'Feixiao'                                  │ │
         │ │           support_set = False                                      │ │
         │ │                  team = 6                                          │ │
         │ │                 trial = 0                                          │ │
         │ ╰────────────────────────────────────────────────────────────────────╯ │
         │                                                                        │
         │ D:\Games\StarRailCopilot\tasks\combat\obtain.py:276 in                 │
         │ obtained_is_full                                                       │
         │                                                                        │
         │   274 │   │   # Update                                                 │
         │   275 │   │   if obtain_get:                                           │
         │ ❱ 276 │   │   │   self.obtain_get(dungeon)                             │
         │   277 │   │                                                            │
         │   278 │   │   # Check progress                                         │
         │                                                                        │
         │ ╭────────────────────────────── locals ──────────────────────────────╮ │
         │ │    dungeon = DungeonList(Calyx_Crimson_Destruction_Herta_StorageZ… │ │
         │ │ obtain_get = True                                                  │ │
         │ │        row = StoredPlannerProxy(                                   │ │
         │ │              │   item=ItemTrace(Worldbreaker_Blade),               │ │
         │ │              │   value=MultiValue(purple=42, blue=104, green=51),  │ │
         │ │              │   total=MultiValue(purple=154, blue=81, green=22),  │ │
         │ │              │   synthesize=MultiValue(                            │ │
         │ │              │   │   purple=10,                                    │ │
         │ │              │   │   blue=9,                                       │ │
         │ │              │   │   green=0                                       │ │
         │ │              │   ),                                                │ │
         │ │              │   time=datetime.datetime(2024, 10, 3, 22, 57, 56),  │ │
         │ │              │   progress=44.4,                                    │ │
         │ │              │   eta=6.8                                           │ │
         │ │              )                                                     │ │
         │ │       self = <tasks.dungeon.dungeon.Dungeon object at              │ │
         │ │              0x0000022DAAAE3A60>                                   │ │
         │ │  wave_done = 0                                                     │ │
         │ ╰────────────────────────────────────────────────────────────────────╯ │
         │                                                                        │
         │ D:\Games\StarRailCopilot\tasks\combat\obtain.py:219 in obtain_get      │
         │                                                                        │
         │   217 │   │   │   logger.attr('trailblaze_exp', trailblaze_exp)        │
         │   218 │   │   │                                                        │
         │ ❱ 219 │   │   │   entry_index = self._obtain_get_entry(dungeon, index= │
         │       start=int(trailblaze_exp))                                       │
         │   220 │   │   │   if entry_index is None:                              │
         │   221 │   │   │   │   logger.info('Obtain get end')                    │
         │                                                                        │
         │ ╭────────────────────────────── locals ──────────────────────────────╮ │
         │ │                     _ = 1                                          │ │
         │ │             dic_entry = {                                          │ │
         │ │                         │   1: OBTAIN_1,                           │ │
         │ │                         │   2: OBTAIN_2,                           │ │
         │ │                         │   3: OBTAIN_3,                           │ │
         │ │                         │   4: OBTAIN_4                            │ │
         │ │                         }                                          │ │
         │ │               dungeon = DungeonList(Calyx_Crimson_Destruction_Her… │ │
         │ │                 entry = OBTAIN_2                                   │ │
         │ │           entry_index = 2                                          │ │
         │ │                 index = 2                                          │ │
         │ │                  item = None                                       │ │
         │ │                 items = []                                         │ │
         │ │                  prev = None                                       │ │
         │ │                  self = <tasks.dungeon.dungeon.Dungeon object at   │ │
         │ │                         0x0000022DAAAE3A60>                        │ │
         │ │ skip_first_screenshot = True                                       │ │
         │ │        trailblaze_exp = True                                       │ │
         │ ╰────────────────────────────────────────────────────────────────────╯ │
         │                                                                        │
         │ D:\Games\StarRailCopilot\tasks\combat\obtain.py:114 in                 │
         │ _obtain_get_entry                                                      │
         │                                                                        │
         │   112 │   │   """                                                      │
         │   113 │   │   if (index > 1 and prev is None) or (index <= 1 and prev  │
         │ ❱ 114 │   │   │   raise ScriptError(f'_obtain_get_entry: index and pre │
         │       index={index}, prev={prev}')                                     │
         │   115 │   │                                                            │
         │   116 │   │   if index > 3:                                            │
         │                                                                        │
         │ ╭────────────────────────────── locals ──────────────────────────────╮ │
         │ │ dungeon = DungeonList(Calyx_Crimson_Destruction_Herta_StorageZone) │ │
         │ │   index = 2                                                        │ │
         │ │    prev = None                                                     │ │
         │ │   start = 1                                                        │ │
         │ ╰────────────────────────────────────────────────────────────────────╯ │
         ╰────────────────────────────────────────────────────────────────────────╯
         ScriptError: _obtain_get_entry: index and prev must be set together,      
         index=2, prev=None                                                        
CRITICAL 03:34:16.191 │ This is likely to be a mistake of developers, but sometimes
         just random issues                                                        
INFO     03:34:16.324 │ No provider specified, skip sending

Screenshots

No response

Anything else?

No response

DrakeVG commented 1 month ago

Found the issue > 03:34:14.402 │ [ITEM_NAME 0.352s] Worldbreaker BladeHwFnomer "BladeHwFnomer" should be just be Blade

LmeSzinc commented 1 month ago

Added a retry on error, you PC is 10 times slower than normal PC, image sticking is more likely to happen

INFO     03:33:50.417 │ [OcrDungeonList 3.233s] ['Enter', ' The Reverie            
         (Dreamscape', 'Bud of Harmony', 'Teleport', ' Robot Settlement', 'ction', 
         'Bud of Destruction', 'Teleport', ' Scalegorge Waterscape', 'Bud of       
         Destruction', 'Teleport', ' Storage Zone', 'vation']