perryhuynh / kcauto

kcauto, the successor to kancolle-auto, a Kantai Collection (Kancolle) bot/automation tool
GNU General Public License v3.0
68 stars 22 forks source link

Ship switch navigation error on last page #384

Closed cplusx closed 4 years ago

cplusx commented 4 years ago

Environment details

Issue variability

Is the issue consistent (can be reproduced consistently) or is it intermittent (only happens sometimes)?: Can be reproduced consistently

Issue

Please provide a thorough description of the issue. Screenshots, videos, or at least a step-by-step description of what is happening in the game is typically necessary to debug. In ship switcher, when navigator goes to second last page, it will click "go to last page button" image Here, I have totally 12 pages of ships, and page navigated to 12th page. Then script raised error as shown in log

Log

[insert ~50 lines of console log (or more) here; remove section if irrelevant]
[2019-09-30 21:00:35] Navigate to shiplist page 11.
[2019-09-30 21:00:37] Click position 1045,891.
[2019-09-30 21:00:38] Navigate to shiplist page 12.
[log] CLICK on L(1193,878)@S(0)[0,0 1920x1080] (680 msec)
[error] script [ /Users/cjx/Desktop/Files_kancolle/kcauto/kcauto.sikuli ] stopped with error in line 76
[error] ValueError ( Invalid shiplist target page (13) for number of known pages (12). )
[error] --- Traceback --- error source first
line: module ( function ) statement
267: shipswitcher (  _navigate_to_shiplist_page )     raise ValueError(
592: shipswitcher (  _resolve_replacement_ship_by_asset )     self._navigate_to_shiplist_page(self.current_shiplist_page + 1)
516: shipswitcher (  _resolve_replacement_ship )     return self._resolve_replacement_ship_by_asset(slot_config)
117: shipswitcher (  ship_switch_logic )     if self._resolve_replacement_ship(slot_config):
398: main (  run_ship_switch_cycle )     self.modules['ship_switcher'].ship_switch_logic()
76: main (  <module> )     kcauto.run_ship_switch_cycle()
[error] --- Traceback --- end --------------

Config

[ShipSwitcher]
Enabled: True
Slot1Criteria: sparkle
Slot1Ships: A:DD:>25:L:_
Slot2Criteria: 
Slot2Ships: 
Slot3Criteria: 
Slot3Ships: 
Slot4Criteria: 
Slot4Ships: 
Slot5Criteria: 
Slot5Ships: 
Slot6Criteria: 
Slot6Ships: 
cplusx commented 4 years ago

After reading code, I found the reason is because script can not find matching ship and keep on navigating to next page. The solution is to reduce SHIP_LIST_SIMILARITY in global setting. I'm gonna close this issue