OCR reading issue leading to ScriptError
totallynotaguynon opened this issue · 0 comments
totallynotaguynon commented
Before you asking
- I have searched the existing issues
- I spend at least 5 minutes for thinking and preparing
- I am using the latest version of SRC
Describe the bug
While trying to do Echo of War with Character Planner get ScriptError
To Reproduce
- Click Start
- Character Planner was set
- Do Echo of War: Salutations of Ashen Dreams
- The name got from the OCR to set the item values, the OCR reads: "Lost Echo of the Shared W" instead of "Lost Echo of the Shared Wish"
- Get ScriptError.
Expected behavior
To read the name of the item correctly
Relevant log output
────────────────────────────────────────────────── DUNGEON NAV GOTO ───────────────────────────────────────────────────
2024-07-22 19:18:54.376 | INFO | DUNGEON NAV GOTO
2024-07-22 19:18:54.377 | INFO | Dungeon nav goto DungeonNav(Echo_of_War)
2024-07-22 19:18:54.822 | INFO | [OCR_DUNGEON_NAV 0.444s] ['Simulated Universe', 'Accumulated Points/Planar',
'Ornaments', 'Calyx (Golden)', 'EXP Materials/Credits', 'Calyx (Crimson)', 'Trace Materials', 'Stagnant Shadow',
'Character Ascension Materials', 'Double', 'Cavern of Corrosion']
2024-07-22 19:18:54.825 | INFO | [OCR_DUNGEON_NAV matched] [DungeonNav(Simulated_Universe), DungeonNav(Calyx_Golden),
DungeonNav(Calyx_Crimson), DungeonNav(Stagnant_Shadow), DungeonNav(Cavern_of_Corrosion)]
2024-07-22 19:18:54.826 | INFO | [DungeonNavList] 3 - 7
2024-07-22 19:18:54.827 | INFO | DUNGEON_NAV_LIST selected at DungeonNav(Simulated_Universe)
2024-07-22 19:18:54.828 | INFO | DUNGEON_NAV_LIST at top
2024-07-22 19:18:54.830 | INFO | Drag ( 326, 546) -> ( 326, 314)
2024-07-22 19:18:55.861 | INFO | [OCR_DUNGEON_NAV 0.386s] ['Calyx (Crimson)', 'Trace Materials', 'Stagnant Shadow',
'Character Ascension Materials', 'Double', 'Cavern of Corrosion', 'Relics', 'Echo of War', 'Advanced Trace
Materials/Light', 'Cones']
2024-07-22 19:18:55.862 | INFO | [OCR_DUNGEON_NAV matched] [DungeonNav(Calyx_Crimson), DungeonNav(Stagnant_Shadow),
DungeonNav(Cavern_of_Corrosion), DungeonNav(Echo_of_War)]
2024-07-22 19:18:55.864 | INFO | [DungeonNavList] 5 - 8
2024-07-22 19:18:55.864 | INFO | DungeonNav row Echo_of_War stabled
2024-07-22 19:18:55.864 | INFO | Select row: DungeonNav(Echo_of_War)
2024-07-22 19:18:55.865 | INFO | Click ( 206, 549) @ DungeonNav(Echo_of_War)
2024-07-22 19:18:57.290 | INFO | [OCR_DUNGEON_NAV 0.414s] ['EXP Materials/Credits', 'Calyx (Crimson)', 'Trace
Materials', 'Stagnant Shadow', 'Character Ascension Materials', 'Double', 'Cavern of Corrosion', 'Relics', 'Echo of
War', 'Advanced Trace Materials/Light', 'Cones']
2024-07-22 19:18:57.292 | INFO | [OCR_DUNGEON_NAV matched] [DungeonNav(Calyx_Crimson), DungeonNav(Stagnant_Shadow),
DungeonNav(Cavern_of_Corrosion), DungeonNav(Echo_of_War)]
2024-07-22 19:18:57.293 | INFO | [DungeonNavList] 5 - 8
2024-07-22 19:18:57.294 | INFO | Row selected at DungeonNav(Echo_of_War)
2024-07-22 19:18:57.295 | INFO | Dungeon list loaded
2024-07-22 19:18:57.303 | INFO | [OCR_WEEKLY_LIMIT] 1/3
2024-07-22 19:18:57.305 | INFO | [OCR_WEEKLY_LIMIT format] 1/3 -> (1, 2, 3)
2024-07-22 19:18:57.305 | INFO | [OCR_WEEKLY_LIMIT 0.010s] (1, 2, 3)
2024-07-22 19:18:57.306 | INFO | [EchoOfWar] 1/3
2024-07-22 19:18:57.310 | INFO | Bind task ['Alas', 'Weekly']
2024-07-22 19:18:57.311 | INFO | Save config ./config\src.json, Dungeon.DungeonStorage.EchoOfWar={'time':
datetime.datetime(2024, 7, 22, 19, 18, 57), 'total': 3, 'value': 1}
─────────────────────────────────────────────────── DUNGEON INSIGHT ───────────────────────────────────────────────────
2024-07-22 19:18:57.321 | INFO | DUNGEON INSIGHT
2024-07-22 19:18:57.322 | INFO | Insight row: DungeonList(Echo_of_War_Salutations_of_Ashen_Dreams), index=56
2024-07-22 19:18:57.758 | INFO | [OCR_DUNGEON_LIST 0.436s] ["This week's reward claims:", 'O6d 9h', '1/3', 'Echo of War
attempt limit', "Echo of War: Destruction's Beginning", '30', ' Supply Zone', 'Teleport', '150', 'Echo of War: End of
the Eternal Freeze', '30', 'Everwinter Hill', 'Teleport', '150', 'Echo of War: Divine Seed', '30', ' Scaleaorae
Waterscape']
2024-07-22 19:18:57.761 | INFO | [OCR_DUNGEON_LIST matched] [DungeonList(Echo_of_War_Destruction_Beginning),
DungeonEntrance(Teleport), DungeonList(Echo_of_War_End_of_the_Eternal_Freeze), DungeonEntrance(Teleport),
DungeonList(Echo_of_War_Divine_Seed)]
2024-07-22 19:18:57.762 | INFO | [DungeonList] 52 - 54
2024-07-22 19:18:57.763 | INFO | [DungeonList] 52 - 54
2024-07-22 19:18:57.764 | INFO | Drag ( 512, 600) -> ( 512, 203)
2024-07-22 19:18:58.439 | INFO | Wait until stable: OCR_DUNGEON_LIST
2024-07-22 19:18:58.611 | INFO | OCR_DUNGEON_LIST stabled
2024-07-22 19:18:59.116 | INFO | [OCR_DUNGEON_LIST 0.503s] ['150', 'Echo of War: Divine Seed', '30', ' Scalegorge
Waterscape', 'Teleport', '150', "Echo of War: Borehole Planet's Old Crater", '30', ' Seclusion Zone', 'Teleport',
'150', 'Echo of War: Salutations of Ashen Dreams', '30', ' Penacony Grand Theater', 'Teleport', '150']
2024-07-22 19:18:59.118 | INFO | [OCR_DUNGEON_LIST matched] [DungeonList(Echo_of_War_Divine_Seed),
DungeonEntrance(Teleport), DungeonList(Echo_of_War_Borehole_Planet_Old_Crater), DungeonEntrance(Teleport),
DungeonList(Echo_of_War_Salutations_of_Ashen_Dreams), DungeonEntrance(Teleport)]
2024-07-22 19:18:59.119 | INFO | [DungeonList] 54 - 56
2024-07-22 19:18:59.121 | INFO | [DungeonList] 54 - 56
──────────────────────────────────────────────────── DUNGEON ENTER ────────────────────────────────────────────────────
2024-07-22 19:18:59.123 | INFO | DUNGEON ENTER
2024-07-22 19:18:59.127 | INFO | Click (1093, 622) @ DungeonList(Echo_of_War_Salutations_of_Ashen_Dreams)
2024-07-22 19:19:00.950 | INFO | [OCR_DUNGEON_LIST 0.701s] ['150', 'Echo of War: Divine Seed', '30', ' Scalegorge
Waterscape', 'Teleport', '150', "Echo of War: Borehole Planet's Old Crater", '30', ' Seclusion Zone', 'Teleport',
'150', 'Echo of War: Salutations of Ashen Dreams', '30', ' Penacony Grand Theater', 'Teleport', '150']
2024-07-22 19:19:00.953 | INFO | [OCR_DUNGEON_LIST matched] [DungeonList(Echo_of_War_Divine_Seed),
DungeonEntrance(Teleport), DungeonList(Echo_of_War_Borehole_Planet_Old_Crater), DungeonEntrance(Teleport),
DungeonList(Echo_of_War_Salutations_of_Ashen_Dreams), DungeonEntrance(Teleport)]
2024-07-22 19:19:00.955 | INFO | [DungeonList] 54 - 56
2024-07-22 19:19:00.956 | INFO | [DungeonList] 54 - 56
2024-07-22 19:19:00.957 | INFO | Click (1080, 621) @ DungeonList(Echo_of_War_Salutations_of_Ashen_Dreams)
2024-07-22 19:19:06.504 | INFO | Arrive COMBAT_PREPARE
═════════════════════════════════════════════════════ DUNGEON RUN ═════════════════════════════════════════════════════
2024-07-22 19:19:06.505 | INFO | DUNGEON RUN
2024-07-22 19:19:06.506 | INFO | Dungeon: DungeonList(Echo_of_War_Salutations_of_Ashen_Dreams), team=1, wave_limit=1,
support_character=FuXuan
2024-07-22 19:19:06.508 | INFO | Combat enter from map
2024-07-22 19:19:06.509 | INFO | At COMBAT_PREPARE
─────────────────────────────────────────────────────── COMBAT ────────────────────────────────────────────────────────
2024-07-22 19:19:06.511 | INFO | COMBAT
2024-07-22 19:19:06.512 | INFO | Combat, team=1, wave=0/1
2024-07-22 19:19:06.512 | INFO | <<< COMBAT PREPARE >>>
2024-07-22 19:19:06.513 | INFO | ['FuXuan', False]
2024-07-22 19:19:06.539 | INFO | Planner item=ItemWeekly(Lost_Echo_of_the_Shared_Wish) value=0 total=12 synthesize=0
time=datetime.datetime(2024, 7, 9, 15, 26, 59) progress=0.0 eta=0.0 come from
DungeonList(Echo_of_War_Salutations_of_Ashen_Dreams)
───────────────────────────────────────────────────── OBTAIN GET ──────────────────────────────────────────────────────
2024-07-22 19:19:06.541 | INFO | OBTAIN GET
2024-07-22 19:19:06.542 | INFO | Find may obtain
2024-07-22 19:19:06.603 | INFO | [trailblaze_exp] True
2024-07-22 19:19:06.605 | INFO | Obtain enter OBTAIN_2
2024-07-22 19:19:06.616 | INFO | Click ( 940, 451) @ OBTAIN_2
2024-07-22 19:19:07.911 | INFO | [ITEM_NAME 0.018s] Lost Echo of the Shared W
2024-07-22 19:19:07.913 | INFO | [ITEM_NAME matched] None
2024-07-22 19:19:07.943 | INFO | [ITEM_AMOUNT] 9
2024-07-22 19:19:07.944 | INFO | [ITEM_AMOUNT format] Currently Owned:9 -> 9
2024-07-22 19:19:07.945 | INFO | [ITEM_AMOUNT 0.031s] 9
2024-07-22 19:19:07.946 | WARNING | _obtain_parse: Unknown item name
2024-07-22 19:19:07.946 | INFO | Obtain close
2024-07-22 19:19:07.948 | INFO | Click (1060, 191) @ ITEM_CLOSE
2024-07-22 19:19:08.381 | INFO | [trailblaze_exp] True
2024-07-22 19:19:08.382 | ERROR | ScriptError: _obtain_get_entry: index and prev must be set together, index=2,
prev=None
┌───────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────┐
│ C:\Games\StarRailCopilot\module\alas.py:79 in run │
│ │
│ 76 │ │ try: │
│ 77 │ │ │ self.device.screenshot() │
│ 78 │ │ │ self.device.screenshot_tracking.clear() │
│ > 79 │ │ │ self.__getattribute__(command)() │
│ 80 │ │ │ return True │
│ 81 │ │ except TaskEnd: │
│ 82 │ │ │ return True │
│ │
│ ┌────────────────────────────────────────────── locals ───────────────────────────────────────────────┐ │
│ │ command = 'weekly' │ │
│ │ e = ScriptError('_obtain_get_entry: index and prev must be set together, index=2, prev=None') │ │
│ │ self = <src.StarRailCopilot object at 0x000002A8F8FE3C70> │ │
│ └─────────────────────────────────────────────────────────────────────────────────────────────────────┘ │
│ │
│ C:\Games\StarRailCopilot\src.py:35 in weekly │
│ │
│ 32 │ │
│ 33 │ def weekly(self): │
│ 34 │ │ from tasks.dungeon.weekly import WeeklyDungeon │
│ > 35 │ │ WeeklyDungeon(config=self.config, device=self.device).run() │
│ 36 │ │
│ 37 │ def daily_quest(self): │
│ 38 │ │ from tasks.daily.daily_quest import DailyQuestUI │
│ │
│ ┌────────────────────────────── locals ──────────────────────────────┐ │
│ │ self = <src.StarRailCopilot object at 0x000002A8F8FE3C70> │ │
│ │ WeeklyDungeon = <class 'tasks.dungeon.weekly.WeeklyDungeon'> │ │
│ └────────────────────────────────────────────────────────────────────┘ │
│ │
│ C:\Games\StarRailCopilot\tasks\dungeon\weekly.py:101 in run │
│ │
│ 98 │ │ self._dungeon_enter(dungeon) │
│ 99 │ │ │
│ 100 │ │ # Combat │
│ > 101 │ │ count = self.dungeon_run(dungeon, wave_limit=min(remain, 3)) │
│ 102 │ │ self.is_doing_planner = False │
│ 103 │ │ │
│ 104 │ │ logger.attr('achieved_daily_quest', self.achieved_daily_quest) │
│ │
│ ┌────────────────────────────────── locals ───────────────────────────────────┐ │
│ │ dungeon = DungeonList(Echo_of_War_Salutations_of_Ashen_Dreams) │ │
│ │ monday = datetime.datetime(2024, 7, 29, 5, 0) │ │
│ │ planner = DungeonList(Echo_of_War_Salutations_of_Ashen_Dreams) │ │
│ │ remain = 1 │ │
│ │ self = <tasks.dungeon.weekly.WeeklyDungeon object at 0x000002A8A795A9E0> │ │
│ └─────────────────────────────────────────────────────────────────────────────┘ │
│ │
│ C:\Games\StarRailCopilot\tasks\dungeon\dungeon.py:220 in dungeon_run │
│ │
│ 217 │ │ │
│ 218 │ │ else: │
│ 219 │ │ │ # Normal run │
│ > 220 │ │ │ return self._dungeon_run(dungeon=dungeon, team=team, wave_limit=wave_limit, │
│ 221 │ │ │ │ │ │ │ │ │ support_character=support_character) │
│ 222 │ │
│ 223 │ def update_double_event_record(self): │
│ │
│ ┌─────────────────────────────────────── locals ────────────────────────────────────────┐ │
│ │ dungeon = DungeonList(Echo_of_War_Salutations_of_Ashen_Dreams) │ │
│ │ require = False │ │
│ │ self = <tasks.dungeon.weekly.WeeklyDungeon object at 0x000002A8A795A9E0> │ │
│ │ support_character = None │ │
│ │ team = None │ │
│ │ wave_limit = 1 │ │
│ └───────────────────────────────────────────────────────────────────────────────────────┘ │
│ │
│ C:\Games\StarRailCopilot\tasks\dungeon\weekly.py:38 in _dungeon_run │
│ │
│ 35 │ │ │ team = self.config.Weekly_Team │
│ 36 │ │ │
│ 37 │ │ skip_ui_switch = True │
│ > 38 │ │ return super()._dungeon_run( │
│ 39 │ │ │ dungeon=dungeon, team=team, wave_limit=wave_limit, │
│ 40 │ │ │ support_character=support_character, skip_ui_switch=skip_ui_switch) │
│ 41 │
│ │
│ ┌─────────────────────────────────────── locals ────────────────────────────────────────┐ │
│ │ dungeon = DungeonList(Echo_of_War_Salutations_of_Ashen_Dreams) │ │
│ │ self = <tasks.dungeon.weekly.WeeklyDungeon object at 0x000002A8A795A9E0> │ │
│ │ skip_ui_switch = True │ │
│ │ support_character = None │ │
│ │ team = 1 │ │
│ │ wave_limit = 1 │ │
│ └───────────────────────────────────────────────────────────────────────────────────────┘ │
│ │
│ C:\Games\StarRailCopilot\tasks\dungeon\dungeon.py:95 in _dungeon_run │
│ │
│ 92 │ │ │
│ 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 │ │ │
│ 98 │ │ # Update quest states │
│ │
│ ┌─────────────────────────────────────── locals ────────────────────────────────────────┐ │
│ │ dungeon = DungeonList(Echo_of_War_Salutations_of_Ashen_Dreams) │ │
│ │ self = <tasks.dungeon.weekly.WeeklyDungeon object at 0x000002A8A795A9E0> │ │
│ │ skip_ui_switch = True │ │
│ │ support_character = 'FuXuan' │ │
│ │ team = 1 │ │
│ │ wave_limit = 1 │ │
│ └───────────────────────────────────────────────────────────────────────────────────────┘ │
│ │
│ C:\Games\StarRailCopilot\tasks\combat\combat.py:414 in combat │
│ │
│ 411 │ │ │ logger.hr('Combat', level=2) │
│ 412 │ │ │ logger.info(f'Combat, team={team}, │
│ wave={self.combat_wave_done}/{self.combat_wave_limit}') │
│ 413 │ │ │ # Prepare │
│ > 414 │ │ │ prepare = self.combat_prepare(team, support_character) │
│ 415 │ │ │ if not prepare: │
│ 416 │ │ │ │ self.combat_exit() │
│ 417 │ │ │ │ break │
│ │
│ ┌───────────────────────────────────────── locals ──────────────────────────────────────────┐ │
│ │ self = <tasks.dungeon.weekly.WeeklyDungeon object at 0x000002A8A795A9E0> │ │
│ │ skip_first_screenshot = True │ │
│ │ support_character = 'FuXuan' │ │
│ │ team = 1 │ │
│ │ wave_limit = 1 │ │
│ └───────────────────────────────────────────────────────────────────────────────────────────┘ │
│ │
│ C:\Games\StarRailCopilot\tasks\combat\combat.py:130 in combat_prepare │
│ │
│ 127 │ │ │ │ self.interval_reset(COMBAT_PREPARE) │
│ 128 │ │ │ │ self.map_A_timer.reset() │
│ 129 │ │ │ if self.appear(COMBAT_PREPARE, interval=2): │
│ > 130 │ │ │ │ if self.is_doing_planner and self.obtained_is_full(self.dungeon, │
│ wave_done=self.combat_wave_done): │
│ 131 │ │ │ │ │ # Update stamina so task can be delayed if both obtained_is_full and │
│ stamina exhausted │
│ 132 │ │ │ │ │ self.combat_get_trailblaze_power() │
│ 133 │ │ │ │ │ return False │
│ │
│ ┌───────────────────────────────────────── locals ──────────────────────────────────────────┐ │
│ │ self = <tasks.dungeon.weekly.WeeklyDungeon object at 0x000002A8A795A9E0> │ │
│ │ skip_first_screenshot = False │ │
│ │ support_character = 'FuXuan' │ │
│ │ support_set = False │ │
│ │ team = 1 │ │
│ │ trial = 0 │ │
│ └───────────────────────────────────────────────────────────────────────────────────────────┘ │
│ │
│ C:\Games\StarRailCopilot\tasks\combat\obtain.py:276 in obtained_is_full │
│ │
│ 273 │ │ │
│ 274 │ │ # Update │
│ 275 │ │ if obtain_get: │
│ > 276 │ │ │ self.obtain_get(dungeon) │
│ 277 │ │ │
│ 278 │ │ # Check progress │
│ 279 │ │ row = self.planner.row_come_from_dungeon(dungeon) │
│ │
│ ┌──────────────────────────────────── locals ────────────────────────────────────┐ │
│ │ dungeon = DungeonList(Echo_of_War_Salutations_of_Ashen_Dreams) │ │
│ │ obtain_get = True │ │
│ │ row = StoredPlannerProxy( │ │
│ │ │ item=ItemWeekly(Lost_Echo_of_the_Shared_Wish), │ │
│ │ │ value=0, │ │
│ │ │ total=12, │ │
│ │ │ synthesize=0, │ │
│ │ │ time=datetime.datetime(2024, 7, 9, 15, 26, 59), │ │
│ │ │ progress=0.0, │ │
│ │ │ eta=0.0 │ │
│ │ ) │ │
│ │ self = <tasks.dungeon.weekly.WeeklyDungeon object at 0x000002A8A795A9E0> │ │
│ │ wave_done = 0 │ │
│ └────────────────────────────────────────────────────────────────────────────────┘ │
│ │
│ C:\Games\StarRailCopilot\tasks\combat\obtain.py:219 in obtain_get │
│ │
│ 216 │ │ │ │ trailblaze_exp = True │
│ 217 │ │ │ logger.attr('trailblaze_exp', trailblaze_exp) │
│ 218 │ │ │ │
│ > 219 │ │ │ entry_index = self._obtain_get_entry(dungeon, index=index, prev=prev, │
│ start=int(trailblaze_exp)) │
│ 220 │ │ │ if entry_index is None: │
│ 221 │ │ │ │ logger.info('Obtain get end') │
│ 222 │ │ │ │ break │
│ │
│ ┌───────────────────────────────────────── locals ──────────────────────────────────────────┐ │
│ │ _ = 1 │ │
│ │ dic_entry = {1: OBTAIN_1, 2: OBTAIN_2, 3: OBTAIN_3, 4: OBTAIN_4} │ │
│ │ dungeon = DungeonList(Echo_of_War_Salutations_of_Ashen_Dreams) │ │
│ │ entry = OBTAIN_2 │ │
│ │ entry_index = 2 │ │
│ │ index = 2 │ │
│ │ item = None │ │
│ │ items = [] │ │
│ │ prev = None │ │
│ │ self = <tasks.dungeon.weekly.WeeklyDungeon object at 0x000002A8A795A9E0> │ │
│ │ skip_first_screenshot = True │ │
│ │ trailblaze_exp = True │ │
│ └───────────────────────────────────────────────────────────────────────────────────────────┘ │
│ │
│ C:\Games\StarRailCopilot\tasks\combat\obtain.py:114 in _obtain_get_entry │
│ │
│ 111 │ │ │ int: Item entry index, or None if no more check needed │
│ 112 │ │ """ │
│ 113 │ │ if (index > 1 and prev is None) or (index <= 1 and prev is not None): │
│ > 114 │ │ │ raise ScriptError(f'_obtain_get_entry: index and prev must be set together, │
│ index={index}, prev={prev}') │
│ 115 │ │ │
│ 116 │ │ if index > 3: │
│ 117 │ │ │ return None │
│ │
│ ┌──────────────────────────── locals ────────────────────────────┐ │
│ │ dungeon = DungeonList(Echo_of_War_Salutations_of_Ashen_Dreams) │ │
│ │ index = 2 │ │
│ │ prev = None │ │
│ │ start = 1 │ │
│ └────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
ScriptError: _obtain_get_entry: index and prev must be set together, index=2, prev=None
2024-07-22 19:19:08.626 | CRITICAL | This is likely to be a mistake of developers, but sometimes just random issues
2024-07-22 19:19:08.670 | INFO | No provider specified, skip sending
2024-07-22 19:22:43.553 | INFO | Electron detected, remove log output to stdout
Screenshots
No response
Anything else?
I "solved" it by just editing the name of item in the auto-generated file "item_weekly.py" and it worked.