SHOW:
|
|
- or go back to the newest paste.
| 1 | /* | |
| 2 | - | Simple KanColle expedition and Leveling script. |
| 2 | + | Simple KanColle AutoHotKey Expedition and Leveling script. |
| 3 | Constantly runs and repairs a solo ship in fleet 3 through 2-3 | |
| 4 | repeatedly. | |
| 5 | Also runs Expedition 2 (Steel and buckets) on Fleet 2, | |
| 6 | and Expedition 5 (Fuel) on Fleet 4. | |
| 7 | Ctrl+Alt+t then Ctrl+Alt+o to start script | |
| 8 | If you don't want to run expeditions, just hit Ctrl+Alt+o. | |
| 9 | ||
| 10 | This script relies on mouse coordinates. Therefore you MUST be running this in 1366 x 768 resolution through the api-link (so the frame resizes with window size) and on firefox with only the Menu Bar and Navigation Toolbars On (View -> toolbars) | |
| 11 | */ | |
| 12 | ||
| 13 | !^p:: pause | |
| 14 | !^s:: suspend | |
| 15 | ||
| 16 | global expedition_1_timer_complete | |
| 17 | global expedition_2_timer_complete | |
| 18 | global expedition_1_fuel_pending | |
| 19 | global expedition_2_fuel_pending | |
| 20 | global expedition_1_dispatch_pending | |
| 21 | global expedition_2_dispatch_pending | |
| 22 | global expedition_trigger | |
| 23 | ||
| 24 | home_screen_check() ; Checks if the current screen is the home screen | |
| 25 | {
| |
| 26 | MouseMove 30, 430, 1 ; Moves mouse out of the way | |
| 27 | PixelSearch shutsugeki_x, shutsugeki_y, 430, 428, 442, 442, 0x209BFB, 2, fast | |
| 28 | if (shutsugeki_y < 441) { ; Check if shutsugeki button is present
| |
| 29 | shutsugeki_ok := 1 | |
| 30 | } | |
| 31 | PixelSearch steel_x, steel_y, 1160, 163, 1198, 177, 0xF2F6FF, 15, fast | |
| 32 | if (steel_y < 176) { ; Check if steel stats are present
| |
| 33 | steel_ok := 1 | |
| 34 | } | |
| 35 | PixelSearch config_x, config_y, 1166, 688, 1186, 710, 0xF2F6FF, 2, fast | |
| 36 | if (config_y < 709) { ; Check if config button is present
| |
| 37 | config_ok := 1 | |
| 38 | } | |
| 39 | condition_check := shutsugeki_ok + steel_ok + config_ok | |
| 40 | if (condition_check = 3) {
| |
| 41 | return 1 | |
| 42 | } else {
| |
| 43 | return 0 | |
| 44 | } | |
| 45 | } | |
| 46 | ||
| 47 | compass_check() ; Checks if the current screen is the compass | |
| 48 | {
| |
| 49 | MouseMove 30, 430, 1 ; Moves mouse out of the way | |
| 50 | PixelSearch center_compass_x, center_compass_y, 691, 396, 698, 407, 0x08088F, 15, fast | |
| 51 | if (shutsugeki_y < 406) { ; Check if shutsugeki button is present
| |
| 52 | center_compass_ok := 1 | |
| 53 | } | |
| 54 | PixelSearch corner_compass_x, corner_compass_y, 238, 669, 249, 675, 0x05073F, 15, fast | |
| 55 | if (steel_y < 674) { ; Check if steel stats are present
| |
| 56 | corner_compass_ok := 1 | |
| 57 | } | |
| 58 | condition_check := center_compass_ok + corner_compass_ok | |
| 59 | if (condition_check = 2) {
| |
| 60 | return 1 | |
| 61 | } else {
| |
| 62 | return 0 | |
| 63 | } | |
| 64 | } | |
| 65 | ||
| 66 | retreat_decision() ; Checks if the current screen is the retreat decision screen | |
| 67 | {
| |
| 68 | MouseMove 30, 430, 1 ; Moves mouse out of the way | |
| 69 | PixelSearch retreat_x, retreat_y, 530, 406, 556, 418, 0xFFFFFF, 5, fast | |
| 70 | if (retreat_y < 417) { ; Check if left button is present
| |
| 71 | retreat_button_ok := 1 | |
| 72 | } | |
| 73 | PixelSearch retreat_x, retreat_y, 807, 402, 834, 425, 0xFFFFFF, 5, fast | |
| 74 | if (retreat_y < 424) { ; Check if right button is present
| |
| 75 | night_battle_ok := 1 | |
| 76 | } | |
| 77 | condition_check := retreat_button_ok + night_battle_ok | |
| 78 | if (condition_check = 2) {
| |
| 79 | return 1 | |
| 80 | } else {
| |
| 81 | return 0 | |
| 82 | } | |
| 83 | ||
| 84 | } | |
| 85 | ||
| 86 | expedition_1: | |
| 87 | expedition_1_timer_complete := 1 | |
| 88 | return | |
| 89 | ||
| 90 | expedition_2: | |
| 91 | expedition_2_timer_complete := 1 | |
| 92 | return | |
| 93 | ||
| 94 | expedition_complete_check() ; Check if expeditions are done and deal with the pop ups | |
| 95 | {
| |
| 96 | if (expedition_1_timer_complete = 1) { ; expedition 1 end check
| |
| 97 | Click 232, 696, 1 ; Click somewhere to get expedition results | |
| 98 | is_expedition_1_results_over_yet := 0 ; Flag to check if it's really over yet | |
| 99 | While (is_expedition_1_results_over_yet = 0) {
| |
| 100 | loop 12 { ; Keep clicking in the corner till it's done
| |
| 101 | Sleep 3000 | |
| 102 | Click 232, 696, 1 | |
| 103 | } | |
| 104 | if (home_screen_check() = 1) { ; Is it REALLY done yet?
| |
| 105 | is_expedition_1_results_over_yet := 1 | |
| 106 | } | |
| 107 | } | |
| 108 | expedition_1_fuel_pending := 1 | |
| 109 | expedition_1_timer_complete := 0 | |
| 110 | } | |
| 111 | ||
| 112 | if (expedition_2_timer_complete = 1) { ; expedition 2 end check
| |
| 113 | Click 232, 696, 1 ; Click somewhere to get expedition results | |
| 114 | is_expedition_2_results_over_yet := 0 ; Flag to check if it's really over yet | |
| 115 | While (is_expedition_2_results_over_yet = 0) {
| |
| 116 | loop 12 { ; Keep clicking in the corner till it's done
| |
| 117 | Sleep 3000 | |
| 118 | Click 232, 696, 1 | |
| 119 | } | |
| 120 | if (home_screen_check() = 1) { ; Is it REALLY done yet?
| |
| 121 | is_expedition_2_results_over_yet := 1 | |
| 122 | } | |
| 123 | } | |
| 124 | expedition_2_fuel_pending := 1 | |
| 125 | expedition_2_timer_complete := 0 | |
| 126 | } | |
| 127 | } | |
| 128 | ||
| 129 | expedition_refuel() ; Refuel expedition fleets | |
| 130 | {
| |
| 131 | if (expedition_1_fuel_pending = 1 OR expedition_2_fuel_pending = 1) { ; Check if fleets are ready to be sent to an expedition
| |
| 132 | Click 275, 401, 1 ; Click Resupply | |
| 133 | Sleep 8000 | |
| 134 | if (expedition_1_fuel_pending = 1) {
| |
| 135 | Click 406, 270, 1 ; Click 2nd fleet | |
| 136 | Sleep 5000 | |
| 137 | Click 330, 272, 1 ; Click select all ships for resupply | |
| 138 | Sleep 3500 | |
| 139 | Click 1075, 685, 1 ; Resupply fleet 2 ships | |
| 140 | Sleep 10000 | |
| 141 | expedition_1_dispatch_pending := 1 | |
| 142 | expedition_1_fuel_pending := 0 | |
| 143 | } | |
| 144 | if (expedition_2_fuel_pending = 1) {
| |
| 145 | Click 483, 270, 1 ; Click 4th fleet | |
| 146 | Sleep 5000 | |
| 147 | Click 330, 272, 1 ; Click select all ships for resupply | |
| 148 | Sleep 3500 | |
| 149 | Click 1075, 685, 1 ; Resupply fleet 4 ships | |
| 150 | Sleep 10000 | |
| 151 | expedition_2_dispatch_pending := 1 | |
| 152 | expedition_2_fuel_pending := 0 | |
| 153 | } | |
| 154 | Click 267, 448, 1 ; Return to home | |
| 155 | Sleep 8000 | |
| 156 | } | |
| 157 | } | |
| 158 | ||
| 159 | expedition_send() ; and send them out to expeditions 2 (Fleet 2) and 5 (Fleet 4) | |
| 160 | {
| |
| 161 | if (expedition_1_dispatch_pending = 1 OR expedition_2_dispatch_pending = 1) {
| |
| 162 | Click 428, 449, 1 ; Click on Shutsugeki button in home | |
| 163 | Sleep 6000 | |
| 164 | Click 1049, 395, 1 ; Click on Expedition button | |
| 165 | Sleep 7000 | |
| 166 | if (expedition_1_dispatch_pending = 1) {
| |
| 167 | Click 508, 378, 1 ; Select Expedition 2 | |
| 168 | Sleep 5000 | |
| 169 | Click 1050, 690, 1 ; Confirm Expedition 2 | |
| 170 | Sleep 5000 | |
| 171 | Click 686, 287, 1 ; Select Fleet 2 | |
| 172 | Sleep 6000 | |
| 173 | Click 984, 692, 1 ; Send out Fleet 2 | |
| 174 | Sleep 2000 | |
| 175 | SetTimer, expedition_1, -1800000 | |
| 176 | expedition_1_dispatch_pending := 0 | |
| 177 | Sleep 8000 | |
| 178 | } | |
| 179 | Sleep 2000 | |
| 180 | if (expedition_2_dispatch_pending = 1) {
| |
| 181 | Click 508, 497, 1 ; Select Expedition 5 | |
| 182 | Sleep 5000 | |
| 183 | Click 1050, 690, 1 ; Confirm Expedition 5 | |
| 184 | Sleep 5000 | |
| 185 | Click 763, 285, 1 ; Select Fleet 4 | |
| 186 | Sleep 6000 | |
| 187 | Click 984, 692, 1 ; Send out Fleet 4 | |
| 188 | Sleep 2000 | |
| 189 | SetTimer, expedition_2, -5400000 | |
| 190 | expedition_2_dispatch_pending := 0 | |
| 191 | Sleep 8000 | |
| 192 | } | |
| 193 | Click 267, 448, 1 ; Return to home | |
| 194 | Sleep 8000 | |
| 195 | } | |
| 196 | } | |
| 197 | ||
| 198 | !^t:: | |
| 199 | expedition_trigger := 1 ; Trigger to also run expeditions with fleets 2 and 4 | |
| 200 | return | |
| 201 | ||
| 202 | !^o:: | |
| 203 | ||
| 204 | if (expedition_trigger = 1) { ; Expedition trigger. Hit Ctrl + Alt + t before Ctrl + Alt + o to include expeditions
| |
| 205 | InputBox, expedition_1_remaining, Expedition 1 Remaining Time, Please input the remaining time until Fleet 2's expedition time is over. Input 0 if Fleet 2 is already home and ready for expedition 2; Input remaining time for 1st expedition in ms. | |
| 206 | SetTimer, expedition_1, -%expedition_1_remaining% | |
| 207 | InputBox, expedition_2_remaining, Expedition 2 Remaining time, Please input the remaining time until Fleet 4's expedition time is over. Input 0 if Fleet 4 is already home and ready for expedition 5 ; Input remaining time for 2nd expedition in ms | |
| 208 | SetTimer, expedition_2, -%expedition_2_remaining% | |
| 209 | } | |
| 210 | ||
| 211 | While (1>0) { ; Run this forever~
| |
| 212 | ||
| 213 | ||
| 214 | While (home_screen_check() = 0) {
| |
| 215 | Sleep 1000 | |
| 216 | } | |
| 217 | Click 428, 449, 1 ; Click on Shutsugeki button in home | |
| 218 | Sleep 3000 | |
| 219 | Click 470, 393, 1 ; Shutsugeki~ | |
| 220 | Sleep 3000 | |
| 221 | ; Click 573, 677, 1 Select Stage 3 | |
| 222 | Click 478, 686 ; Select Stage 2 | |
| 223 | Sleep 3000 | |
| 224 | ; Click 828, 166, 1 Select 3-2 | |
| 225 | Click 540, 560 ; Selects 2-3 | |
| 226 | Sleep 3000 | |
| 227 | Click 1048, 690, 1 ; Confirm Stage Select | |
| 228 | Sleep 3000 | |
| 229 | Click 722, 270, 1 ; Select Fleet 3 | |
| 230 | Sleep 3000 | |
| 231 | Click 983, 694 ; Begin Sortie- | |
| 232 | Sleep 3000 | |
| 233 | ||
| 234 | While (compass_check() = 0) { ; Wait till compass is out
| |
| 235 | Sleep 1000 | |
| 236 | } | |
| 237 | Sleep 1500 | |
| 238 | Click 232, 696, 1 ; Spin the compass (click on bottom left corner) | |
| 239 | ||
| 240 | shutsugeki_chuu := 1 ; Currently in sortie. Keep clicking/checking till out of sortie. | |
| 241 | While (shutsugeki_chuu = 1) {
| |
| 242 | Sleep 3000 | |
| 243 | Click 232, 696, 1 ; Click in the corner | |
| 244 | if retreat_decision() {
| |
| 245 | Click 540, 412, 1 ; Click left button to skip night battle / continue sortie | |
| 246 | Sleep 3000 | |
| 247 | } else if home_screen_check() {
| |
| 248 | shutsugeki_chuu := 0 | |
| 249 | } | |
| 250 | } | |
| 251 | ||
| 252 | if (expedition_trigger = 1) {
| |
| 253 | expedition_complete_check() ; Check if expeditions are done. Deal with popups if they are | |
| 254 | expedition_complete_check() ; One more check just in case another expedition completed during the first one | |
| 255 | expedition_refuel() ; Refuel expedition fleets | |
| 256 | expedition_complete_check() ; One more check in case another expedition completed dring refuel | |
| 257 | expedition_refuel() ; Another refuel attempt for the check one line above | |
| 258 | expedition_send() ; Send out fleets to expedition | |
| 259 | expedition_complete_check() ; Anoother check just in case expedition completes during prior send | |
| 260 | expedition_refuel() ; Another refuel attempt for the check one line above | |
| 261 | expedition_send() ; Another send out attempt for the check two lines above | |
| 262 | } | |
| 263 | ||
| 264 | Click 275, 401, 1 ; Click Resupply | |
| 265 | Sleep 3000 | |
| 266 | Click 445, 271, 1 ; Click 3rd fleet | |
| 267 | Sleep 3000 | |
| 268 | Click 330, 271, 1 ; Click select all ships for resupply | |
| 269 | Sleep 2500 | |
| 270 | Click 1075, 685, 1 ; Resupply ships | |
| 271 | Sleep 11000 | |
| 272 | Click 197, 526, 1 ; Click on Dock | |
| 273 | Sleep 6000 | |
| 274 | Click 501, 328 ; Click on First Dock | |
| 275 | Sleep 5000 | |
| 276 | ||
| 277 | ; Check if ship is in green health or not | |
| 278 | ship_is_healthy := 0 | |
| 279 | MouseMove 30, 430, 1 ; Moves mouse out of the way | |
| 280 | PixelSearch first_slot_x, first_slot_y, 974, 287, 989, 300, 0x00FF00, 0, fast | |
| 281 | if (first_slot_y < 299) { ; Check if shutsugeki button is present
| |
| 282 | ship_is_healthy := 1 | |
| 283 | } | |
| 284 | if (ship_is_healthy = 0) {
| |
| 285 | Click 838, 296, 1 ; Click the first ship | |
| 286 | Sleep 3000 | |
| 287 | Click 1060, 680 ; Begin docking | |
| 288 | Sleep 3000 | |
| 289 | Click 823, 631 ; Confirm Docking | |
| 290 | Sleep 15000 | |
| 291 | While (ship_is_healthy = 0) {
| |
| 292 | MouseMove 30, 430, 1 ; Moves mouse out of the way | |
| 293 | Sleep 5000 | |
| 294 | PixelSearch repairing_x, repairing_y, 1135, 291, 1159, 313, 0x36D1B3, 10, fast | |
| 295 | if (repairing_y < 312) { ; Check if ship is being repaired
| |
| 296 | ship_is_repairing := 1 | |
| 297 | } else {
| |
| 298 | ship_is_repairing := 0 | |
| 299 | } | |
| 300 | if (ship_is_repairing = 0) {
| |
| 301 | PixelSearch healthy_x, healthy_y, 1137, 307, 1146, 313, 0xD4C3A9, 8, fast | |
| 302 | if (healthy_y < 312) { ; Check if ship is no longer in dock and is done being repaired
| |
| 303 | ship_is_healthy := 1 | |
| 304 | } | |
| 305 | } | |
| 306 | } | |
| 307 | } | |
| 308 | ||
| 309 | Click 267, 448, 1 ; Click back to home | |
| 310 | Sleep 6000 | |
| 311 | ||
| 312 | if (expedition_trigger = 1) {
| |
| 313 | expedition_complete_check() ; Check if expeditions are done. Deal with popups if they are | |
| 314 | expedition_complete_check() ; One more check just in case another expedition completed during the first one | |
| 315 | expedition_refuel() ; Refuel expedition fleets | |
| 316 | expedition_complete_check() ; One more check in case another expedition completed dring refuel | |
| 317 | expedition_refuel() ; Another refuel attempt for the check one line above | |
| 318 | expedition_send() ; Send out fleets to expedition | |
| 319 | expedition_complete_check() ; Anoother check just in case expedition completes during prior send | |
| 320 | expedition_refuel() ; Another refuel attempt for the check one line above | |
| 321 | expedition_send() ; Another send out attempt for the check two lines above | |
| 322 | } | |
| 323 | ||
| 324 | } | |
| 325 | ||
| 326 | return |