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

Expeditions doesn't run. #371

Closed Kiras756 closed 5 years ago

Kiras756 commented 5 years ago

Environment details

Issue variability

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

Issue

Kcauto trying to sent expeditions, but fails every time. I'm tried to put lower text_similiarity, but without any effect.

Log

[2019-07-20 02:49:44] Initializing config module.
[2019-07-20 02:49:44] Reading config.
[2019-07-20 02:49:44] Starting kcauto!
[log] App.focus:  [2756:Opera]
[2019-07-20 02:49:52] At home
[2019-07-20 02:49:52] Refreshing home.
[log] CLICK on L(158,512)@S(0)[0,0 1280x1024] (515 msec)
[log] CLICK on L(159,567)@S(0)[0,0 1280x1024] (516 msec)
[log] App.focus:  [2756:Opera]
[2019-07-20 02:50:06] At home
[2019-07-20 02:50:06] Navigating to expedition screen.
[log] CLICK on L(341,595)@S(0)[0,0 1280x1024] (515 msec)
[log] CLICK on L(1073,547)@S(0)[0,0 1280x1024] (516 msec)
[2019-07-20 02:50:11] Sortieing fleet 2 to expedition 5
[log] CLICK on L(219,831)@S(0)[0,0 1280x1024] (516 msec)
[2019-07-20 02:50:16] Could not find desired expedition (5). Please make sure it is unlocked.
[info] Exit code: 1
Kiras756 commented 5 years ago

https://funkyimg.com/i/2VBGr.png

mrmin123 commented 5 years ago

As of 7.5.0, the TEXT_SIMILARITY flag no longer has an impact on the expedition module as the expedition module is now mainly reliant on OCR. I believe the difference in font-rendering, however, continues to cause issues, even for OCR.

Could you add this line after line 188 in expedition.py and report back the logs?:

            print(expedition_name)
mrmin123 commented 5 years ago

Also, try turning on ClearType..:

Kiras756 commented 5 years ago

Turning on ClearType has no effect.

Tried to put code-line https://funkyimg.com/i/2VBM5.png but KCauto returns an error

[error] script [ C:\Sikuli 1.1.3\kcauto-master\kcauto.sikuli ] stopped with error at line --unknown--
[error] Error caused by: Traceback (most recent call last):
  File "C:\Sikuli 1.1.3\kcauto-master\kcauto.sikuli\kcauto.py", line 15, in <module>
    from main import KCAuto  # noqa
  File "C:\Sikuli 1.1.3\kcauto-master\kcauto.sikuli\main.py", line 3, in <module>
    from expedition import ExpeditionModule, ExpeditionFleet
  File "C:\Application Data\Sikulix\Lib\sikuli\SikuliImporter.py", line 45, in load_module
    return self._load_module(module_name)
  File "C:\Application Data\Sikulix\Lib\sikuli\SikuliImporter.py", line 34, in _load_module
    return imp.load_module(fullname, file, pathname, desc)
  File "<string>", line None
SyntaxError: !!WHILE IMPORTING!! mismatched input '' expecting DEDENT (expedition.py, line 189)
mrmin123 commented 5 years ago

Make sure you're using spaces to indent, not tabs.

mrmin123 commented 5 years ago

Also, are you sure ClearType is turned on? I'd expect it to look like something like this, with anti-aliased fonts:

Kiras756 commented 5 years ago

Honestly, I see no effect on digits. https://funkyimg.com/i/2VBN7.png

Make sure you're using spaces to indent, not tabs. ow, okay, but nothing new

[2019-07-20 06:37:43] Initializing config module.
[2019-07-20 06:37:43] Reading config.
[2019-07-20 06:37:43] Starting kcauto!
[log] App.focus:  [3808:Opera]
[2019-07-20 06:37:51] At home
[2019-07-20 06:37:51] Refreshing home.
[log] CLICK on L(525,450)@S(0)[0,0 1280x1024] (531 msec)
[log] CLICK on L(158,536)@S(0)[0,0 1280x1024] (516 msec)
[log] App.focus:  [3808:Opera]
[2019-07-20 06:38:05] At home
[2019-07-20 06:38:05] Navigating to expedition screen.
[log] CLICK on L(345,543)@S(0)[0,0 1280x1024] (532 msec)
[log] CLICK on L(1097,447)@S(0)[0,0 1280x1024] (516 msec)
[2019-07-20 06:38:10] Sortieing fleet 2 to expedition 5
[log] CLICK on L(257,826)@S(0)[0,0 1280x1024] (516 msec)
[2019-07-20 06:38:15] Could not find desired expedition (5). Please make sure it is unlocked.
[info] Exit code: 1
mrmin123 commented 5 years ago

Interesting. The issue isn't actually the OCR of the expedition number... it's the matching on the expedition rank:

image

(non-black in that square highlights differences)

Try changing line 182 from

            Pattern(rank_symbol).exact())

to

            rank_symbol)

If this also fails, you might have to generate your own captures of the expedition_rank_*.png assets for the moment...

Kiras756 commented 5 years ago

Changing line 182 helped! Now all expeditions successfully sent!

mrmin123 commented 5 years ago

Cool. Let's keep this open for a bit more while I ascertain if this should be part of the main codebase or a spotfix.

Kiras756 commented 5 years ago

hmm seems like not all is good sometimes KCauto return the same error, what before

[2019-07-20 06:56:09] Initializing config module.
[2019-07-20 06:56:09] Reading config.
[2019-07-20 06:56:09] Starting kcauto!
[log] App.focus:  [2580:Opera]
[2019-07-20 06:56:17] At home
[2019-07-20 06:56:17] Refreshing home.
[log] CLICK on L(503,489)@S(0)[0,0 1280x1024] (516 msec)
[log] CLICK on L(152,524)@S(0)[0,0 1280x1024] (516 msec)
[log] App.focus:  [2580:Opera]
[2019-07-20 06:56:32] At home
[2019-07-20 06:56:32] Navigating to expedition screen.
[log] CLICK on L(300,478)@S(0)[0,0 1280x1024] (516 msec)
[log] CLICK on L(988,387)@S(0)[0,0 1280x1024] (516 msec)
[2019-07-20 06:56:37] Sortieing fleet 2 to expedition 5
[log] CLICK on L(210,828)@S(0)[0,0 1280x1024] (516 msec)
05
[2019-07-20 06:56:43] Click position 780,585.
[log] CLICK on L(1106,830)@S(0)[0,0 1280x1024] (516 msec)
[2019-07-20 06:56:48] Fleet needs resupply!
[log] CLICK on L(772,807)@S(0)[0,0 1280x1024] (516 msec)
[2019-07-20 06:56:49] Resupplying with supply fairy.
[log] CLICK on L(853,793)@S(0)[0,0 1280x1024] (516 msec)
[2019-07-20 06:56:55] Fleet 2 sortied. Expected return time: 2019-07-20 08:26:25
[2019-07-20 06:56:59] Sortieing fleet 3 to expedition 21
[log] CLICK on L(344,831)@S(0)[0,0 1280x1024] (516 msec)
21
[2019-07-20 06:57:04] Click position 432,600.
[log] CLICK on L(993,820)@S(0)[0,0 1280x1024] (516 msec)
[log] CLICK on L(654,326)@S(0)[0,0 1280x1024] (516 msec)
[2019-07-20 06:57:12] Fleet needs resupply!
[log] CLICK on L(765,797)@S(0)[0,0 1280x1024] (515 msec)
[2019-07-20 06:57:13] Resupplying with supply fairy.
[log] CLICK on L(1059,835)@S(0)[0,0 1280x1024] (516 msec)
[2019-07-20 06:57:18] Fleet 3 sortied. Expected return time: 2019-07-20 09:16:48
[2019-07-20 06:57:24] Sortieing fleet 4 to expedition 38
[log] CLICK on L(531,825)@S(0)[0,0 1280x1024] (516 msec)
37
35
36
39
38
[2019-07-20 06:57:29] Click position 556,643.
[log] CLICK on L(1154,845)@S(0)[0,0 1280x1024] (515 msec)
[log] CLICK on L(704,310)@S(0)[0,0 1280x1024] (515 msec)
[2019-07-20 06:57:37] Fleet needs resupply!
[log] CLICK on L(768,797)@S(0)[0,0 1280x1024] (515 msec)
[2019-07-20 06:57:38] Resupplying with supply fairy.
[log] CLICK on L(989,804)@S(0)[0,0 1280x1024] (516 msec)
[2019-07-20 06:57:43] Fleet 4 sortied. Expected return time: 2019-07-20 09:52:13
[2019-07-20 06:57:48] End of cycle 1
[2019-07-20 06:57:48] Fleet 2: Expedition returns at 2019-07-20 08:26:25
[2019-07-20 06:57:48] Fleet 3: Expedition returns at 2019-07-20 09:16:48
[2019-07-20 06:57:48] Fleet 4: Expedition returns at 2019-07-20 09:52:13
[2019-07-20 06:57:48] Expeditions sent: 3 / received: 0
[2019-07-20 06:57:48] Resupplies: 0 || Fairy resupplies: 3
[2019-07-20 06:57:48] Recoveries done: 0
[2019-07-20 06:57:48] kcauto has been running for 0 hours 1 minutes (started on 2019-07-20 06:56:09)
[2019-07-20 08:26:48] At side menu
[2019-07-20 08:26:48] Going home.
[log] CLICK on L(44,535)@S(0)[0,0 1280x1024] (516 msec)
[log] CLICK on L(133,540)@S(0)[0,0 1280x1024] (515 msec)
[2019-07-20 08:26:56] Click position 658,332.
[2019-07-20 08:26:56] An expedition fleet has returned. Probably fleet 2
[2019-07-20 08:27:07] Click position 1053,345.
[2019-07-20 08:27:09] Click position 805,680.
[log] App.focus:  [2580:Opera]
[2019-07-20 08:27:18] At home
[2019-07-20 08:27:18] Navigating to expedition screen.
[log] CLICK on L(300,501)@S(0)[0,0 1280x1024] (516 msec)
[log] CLICK on L(1100,416)@S(0)[0,0 1280x1024] (516 msec)
[2019-07-20 08:27:25] Sortieing fleet 2 to expedition 5
[log] CLICK on L(217,834)@S(0)[0,0 1280x1024] (516 msec)
05
[2019-07-20 08:27:29] Click position 763,587.
[log] CLICK on L(1122,835)@S(0)[0,0 1280x1024] (515 msec)
[2019-07-20 08:27:35] Fleet needs resupply!
[log] CLICK on L(770,806)@S(0)[0,0 1280x1024] (516 msec)
[2019-07-20 08:27:36] Resupplying with supply fairy.
[log] CLICK on L(888,807)@S(0)[0,0 1280x1024] (515 msec)
[2019-07-20 08:27:41] Fleet 2 sortied. Expected return time: 2019-07-20 09:57:11
[2019-07-20 08:27:45] End of cycle 2
[2019-07-20 08:27:45] Fleet 2: Expedition returns at 2019-07-20 09:57:11
[2019-07-20 08:27:45] Fleet 3: Expedition returns at 2019-07-20 09:16:48
[2019-07-20 08:27:45] Fleet 4: Expedition returns at 2019-07-20 09:52:13
[2019-07-20 08:27:45] Expeditions sent: 4 (2.62/hr) / received: 1 (0.66/hr)
[2019-07-20 08:27:45] Resupplies: 0 || Fairy resupplies: 4 (2.62/hr)
[2019-07-20 08:27:45] Recoveries done: 0
[2019-07-20 08:27:45] kcauto has been running for 1 hours 31 minutes (started on 2019-07-20 06:56:09)
[2019-07-20 09:17:10] At side menu
[2019-07-20 09:17:10] Going home.
[log] CLICK on L(130,515)@S(0)[0,0 1280x1024] (516 msec)
[2019-07-20 09:17:15] Click position 597,608.
[2019-07-20 09:17:15] An expedition fleet has returned. Probably fleet 3
[2019-07-20 09:17:26] Click position 995,354.
[2019-07-20 09:17:29] Click position 804,333.
[log] App.focus:  [2580:Opera]
[2019-07-20 09:17:38] At home
[2019-07-20 09:17:38] Navigating to expedition screen.
[log] CLICK on L(318,549)@S(0)[0,0 1280x1024] (515 msec)
[log] CLICK on L(975,603)@S(0)[0,0 1280x1024] (516 msec)
[2019-07-20 09:17:42] Sortieing fleet 3 to expedition 21
[log] CLICK on L(358,830)@S(0)[0,0 1280x1024] (515 msec)
21
[2019-07-20 09:17:47] Click position 557,590.
[log] CLICK on L(1171,805)@S(0)[0,0 1280x1024] (515 msec)
[log] CLICK on L(658,328)@S(0)[0,0 1280x1024] (516 msec)
[2019-07-20 09:17:54] Fleet needs resupply!
[log] CLICK on L(765,804)@S(0)[0,0 1280x1024] (515 msec)
[2019-07-20 09:17:55] Resupplying with supply fairy.
[log] CLICK on L(1064,809)@S(0)[0,0 1280x1024] (515 msec)
[2019-07-20 09:18:00] Fleet 3 sortied. Expected return time: 2019-07-20 11:37:30
[2019-07-20 09:18:05] End of cycle 3
[2019-07-20 09:18:05] Fleet 2: Expedition returns at 2019-07-20 09:57:11
[2019-07-20 09:18:05] Fleet 3: Expedition returns at 2019-07-20 11:37:30
[2019-07-20 09:18:05] Fleet 4: Expedition returns at 2019-07-20 09:52:13
[2019-07-20 09:18:05] Expeditions sent: 5 (2.11/hr) / received: 2 (0.85/hr)
[2019-07-20 09:18:05] Resupplies: 0 || Fairy resupplies: 5 (2.11/hr)
[2019-07-20 09:18:05] Recoveries done: 0
[2019-07-20 09:18:05] kcauto has been running for 2 hours 21 minutes (started on 2019-07-20 06:56:09)
[2019-07-20 09:52:27] At side menu
[2019-07-20 09:52:27] Going home.
[log] CLICK on L(139,531)@S(0)[0,0 1280x1024] (516 msec)
[2019-07-20 09:52:32] Click position 775,499.
[2019-07-20 09:52:32] An expedition fleet has returned. Probably fleet 4
[2019-07-20 09:52:43] Click position 1049,389.
[2019-07-20 09:52:45] Click position 995,502.
[log] App.focus:  [2580:Opera]
[2019-07-20 09:52:55] At home
[2019-07-20 09:52:55] Navigating to expedition screen.
[log] CLICK on L(339,547)@S(0)[0,0 1280x1024] (515 msec)
[log] CLICK on L(1089,476)@S(0)[0,0 1280x1024] (515 msec)
[2019-07-20 09:52:59] Sortieing fleet 4 to expedition 38
[log] CLICK on L(562,840)@S(0)[0,0 1280x1024] (515 msec)
[2019-07-20 09:53:04] Could not find desired expedition (38). Please make sure it is unlocked.
[info] Exit code: 1

It can happen right after start script or some time later, for a while I use wscript for restart KCauto every time after error exit.

mrmin123 commented 5 years ago

@Kiras756 try increasing the wait in L171 (Util.kc_sleep(2)).

Kiras756 commented 5 years ago

I will report when pass enough time.

Kiras756 commented 5 years ago

Well, KCauto already run for about 20.5 hours without any error.

mrmin123 commented 5 years ago

A combination of increasing the wait on L171 to 2 and increasing the region padding on L186 to 38 seems to have resolved the issue for most individuals reporting the issue. Will test a bit further before cutting a release.

kenahamtan commented 5 years ago

I started to have issue with exp 05 after 8/8 update. No issue with 15,25,35.

OCR of 05 became 0S

]9;11;"java.exe: ExtSetAttributes(0x0E)"\]9;11;"java.exe: ExtSetAttributes(0x07)"\[2019-08-09 07:42:08] Sortieing fleet 3 to expedition 5 ]9;11;"java.exe: ExtSetAttributes(0x09)"\]9;11;"java.exe: ExtSetAttributes(0x07)"og] CLICK on L(241,1012)@S(0)[0,0 1920x1080] (531 msec) 0S 06 07 [2019-08-09 07:42:13] Could not find desired expedition (5). Please make sure it is unlocked. ]9;11;"java.exe: ExtSetAttributes(0x0C)"\]9;11;"java.exe: ExtSetAttributes(0x07)"nfo] Exit code: 1

kenahamtan commented 5 years ago

I added this after line 188 in expedition.py

expedition_name = expedition_name.replace('S', '5')

seems to work for exp 05 for now.