Closed mrmin123 closed 7 years ago
Haven't tested the new branch, but I wonder if you factored in if the sub is sparkled, might interfere with the matchig of the class icon.
I did! Had to lower the similarity to 0.7 but I also did negative testing with every other ship class I had and there were no false positives.
There are still some issues with the branch... still trying to figure out what's causing them.
What issues? I might be able to help point them out
It seems like sometimes the target_region
defined within the submarine switch routine sometimes defines a region off the screen, thus causing a crash. kancolle-auto recovers fine from it, but it's still a weird behavior.
[2017-03-13 11:17:50] Found ship that is moderately fatigued!
[error] Region(-112,173,11,13) outside any screen - subsequent actions might not work as expected
M[58,203 11x13]@S(S(0)[0,0 1600x900]) S:0.70 C:63,209 [-1 msec]
R[0,186 94x110]@S(0) E:Y, T:3.0
There were no moderately-fatigued ships in the fleet. Manually searching for the fatigue_med
asset on the screen had no matches:
+ Sikuli match object for 'fatigue_med.png' in window 'Chrome'
+ with minimum similarity of 0.7:
No matches!
Had to bump up the similarity of fatigue state icons to 0.98 (+0.8 was enough, actually) otherwise Sikuli reported intermittent false positives.
The thresholds have to be reworked I think...the script has failed to identify submarines to switch on several occasions already. Ran the script for 2 hours just now and it averaged at 6.68 sorties per hour with only 3 subs switched. Script is waiting for repairs at a lot of times.
Edit: I even decreased CLASS_SIMILARITY to 0.6 to increase the odds of matching the class icon, but no luck
ok forget what I said just now, found the main culprit:
if self.kc_region.exists(Pattern('ship_class_ss.png').similar(CLASS_SIMILARITY) or
Pattern('ship_class_ssv.png').similar(CLASS_SIMILARITY)):
has to be changed to
if (self.kc_region.exists(Pattern('ship_class_ss.png').similar(CLASS_SIMILARITY)) or
self.kc_region.exists(Pattern('ship_class_ssv.png').similar(CLASS_SIMILARITY))):
and also kc_region is a bit too broad I think? using target_region seems like a better idea
@waicool20 Gah, good catch. That's what I get for coding with a headache.
Alleviates likelihood of issues such as #327 and #328, as well as performance improvements