Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Simple KanColle AutoHotKey Expedition and Leveling script.
- Constantly runs and repairs a solo ship in fleet 3 through 2-3
- repeatedly.
- Also runs Expedition 2 (Steel and buckets) on Fleet 2,
- and Expedition 5 (Fuel) on Fleet 4.
- Ctrl+Alt+t then Ctrl+Alt+o to start script
- If you don't want to run expeditions, just hit Ctrl+Alt+o.
- 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)
- */
- !^p:: pause
- !^s:: suspend
- global expedition_1_timer_complete
- global expedition_2_timer_complete
- global expedition_1_fuel_pending
- global expedition_2_fuel_pending
- global expedition_1_dispatch_pending
- global expedition_2_dispatch_pending
- global expedition_trigger
- home_screen_check() ; Checks if the current screen is the home screen
- {
- MouseMove 30, 430, 1 ; Moves mouse out of the way
- PixelSearch shutsugeki_x, shutsugeki_y, 430, 428, 442, 442, 0x209BFB, 2, fast
- if (shutsugeki_y < 441) { ; Check if shutsugeki button is present
- shutsugeki_ok := 1
- }
- PixelSearch steel_x, steel_y, 1160, 163, 1198, 177, 0xF2F6FF, 15, fast
- if (steel_y < 176) { ; Check if steel stats are present
- steel_ok := 1
- }
- PixelSearch config_x, config_y, 1166, 688, 1186, 710, 0xF2F6FF, 2, fast
- if (config_y < 709) { ; Check if config button is present
- config_ok := 1
- }
- condition_check := shutsugeki_ok + steel_ok + config_ok
- if (condition_check = 3) {
- return 1
- } else {
- return 0
- }
- }
- compass_check() ; Checks if the current screen is the compass
- {
- MouseMove 30, 430, 1 ; Moves mouse out of the way
- PixelSearch center_compass_x, center_compass_y, 691, 396, 698, 407, 0x08088F, 15, fast
- if (shutsugeki_y < 406) { ; Check if shutsugeki button is present
- center_compass_ok := 1
- }
- PixelSearch corner_compass_x, corner_compass_y, 238, 669, 249, 675, 0x05073F, 15, fast
- if (steel_y < 674) { ; Check if steel stats are present
- corner_compass_ok := 1
- }
- condition_check := center_compass_ok + corner_compass_ok
- if (condition_check = 2) {
- return 1
- } else {
- return 0
- }
- }
- retreat_decision() ; Checks if the current screen is the retreat decision screen
- {
- MouseMove 30, 430, 1 ; Moves mouse out of the way
- PixelSearch retreat_x, retreat_y, 530, 406, 556, 418, 0xFFFFFF, 5, fast
- if (retreat_y < 417) { ; Check if left button is present
- retreat_button_ok := 1
- }
- PixelSearch retreat_x, retreat_y, 807, 402, 834, 425, 0xFFFFFF, 5, fast
- if (retreat_y < 424) { ; Check if right button is present
- night_battle_ok := 1
- }
- condition_check := retreat_button_ok + night_battle_ok
- if (condition_check = 2) {
- return 1
- } else {
- return 0
- }
- }
- expedition_1:
- expedition_1_timer_complete := 1
- return
- expedition_2:
- expedition_2_timer_complete := 1
- return
- expedition_complete_check() ; Check if expeditions are done and deal with the pop ups
- {
- if (expedition_1_timer_complete = 1) { ; expedition 1 end check
- Click 232, 696, 1 ; Click somewhere to get expedition results
- is_expedition_1_results_over_yet := 0 ; Flag to check if it's really over yet
- While (is_expedition_1_results_over_yet = 0) {
- loop 12 { ; Keep clicking in the corner till it's done
- Sleep 3000
- Click 232, 696, 1
- }
- if (home_screen_check() = 1) { ; Is it REALLY done yet?
- is_expedition_1_results_over_yet := 1
- }
- }
- expedition_1_fuel_pending := 1
- expedition_1_timer_complete := 0
- }
- if (expedition_2_timer_complete = 1) { ; expedition 2 end check
- Click 232, 696, 1 ; Click somewhere to get expedition results
- is_expedition_2_results_over_yet := 0 ; Flag to check if it's really over yet
- While (is_expedition_2_results_over_yet = 0) {
- loop 12 { ; Keep clicking in the corner till it's done
- Sleep 3000
- Click 232, 696, 1
- }
- if (home_screen_check() = 1) { ; Is it REALLY done yet?
- is_expedition_2_results_over_yet := 1
- }
- }
- expedition_2_fuel_pending := 1
- expedition_2_timer_complete := 0
- }
- }
- expedition_refuel() ; Refuel expedition fleets
- {
- if (expedition_1_fuel_pending = 1 OR expedition_2_fuel_pending = 1) { ; Check if fleets are ready to be sent to an expedition
- Click 275, 401, 1 ; Click Resupply
- Sleep 8000
- if (expedition_1_fuel_pending = 1) {
- Click 406, 270, 1 ; Click 2nd fleet
- Sleep 5000
- Click 330, 272, 1 ; Click select all ships for resupply
- Sleep 3500
- Click 1075, 685, 1 ; Resupply fleet 2 ships
- Sleep 10000
- expedition_1_dispatch_pending := 1
- expedition_1_fuel_pending := 0
- }
- if (expedition_2_fuel_pending = 1) {
- Click 483, 270, 1 ; Click 4th fleet
- Sleep 5000
- Click 330, 272, 1 ; Click select all ships for resupply
- Sleep 3500
- Click 1075, 685, 1 ; Resupply fleet 4 ships
- Sleep 10000
- expedition_2_dispatch_pending := 1
- expedition_2_fuel_pending := 0
- }
- Click 267, 448, 1 ; Return to home
- Sleep 8000
- }
- }
- expedition_send() ; and send them out to expeditions 2 (Fleet 2) and 5 (Fleet 4)
- {
- if (expedition_1_dispatch_pending = 1 OR expedition_2_dispatch_pending = 1) {
- Click 428, 449, 1 ; Click on Shutsugeki button in home
- Sleep 6000
- Click 1049, 395, 1 ; Click on Expedition button
- Sleep 7000
- if (expedition_1_dispatch_pending = 1) {
- Click 508, 378, 1 ; Select Expedition 2
- Sleep 5000
- Click 1050, 690, 1 ; Confirm Expedition 2
- Sleep 5000
- Click 686, 287, 1 ; Select Fleet 2
- Sleep 6000
- Click 984, 692, 1 ; Send out Fleet 2
- Sleep 2000
- SetTimer, expedition_1, -1800000
- expedition_1_dispatch_pending := 0
- Sleep 8000
- }
- Sleep 2000
- if (expedition_2_dispatch_pending = 1) {
- Click 508, 497, 1 ; Select Expedition 5
- Sleep 5000
- Click 1050, 690, 1 ; Confirm Expedition 5
- Sleep 5000
- Click 763, 285, 1 ; Select Fleet 4
- Sleep 6000
- Click 984, 692, 1 ; Send out Fleet 4
- Sleep 2000
- SetTimer, expedition_2, -5400000
- expedition_2_dispatch_pending := 0
- Sleep 8000
- }
- Click 267, 448, 1 ; Return to home
- Sleep 8000
- }
- }
- !^t::
- expedition_trigger := 1 ; Trigger to also run expeditions with fleets 2 and 4
- return
- !^o::
- if (expedition_trigger = 1) { ; Expedition trigger. Hit Ctrl + Alt + t before Ctrl + Alt + o to include expeditions
- 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.
- SetTimer, expedition_1, -%expedition_1_remaining%
- 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
- SetTimer, expedition_2, -%expedition_2_remaining%
- }
- While (1>0) { ; Run this forever~
- While (home_screen_check() = 0) {
- Sleep 1000
- }
- Click 428, 449, 1 ; Click on Shutsugeki button in home
- Sleep 3000
- Click 470, 393, 1 ; Shutsugeki~
- Sleep 3000
- ; Click 573, 677, 1 Select Stage 3
- Click 478, 686 ; Select Stage 2
- Sleep 3000
- ; Click 828, 166, 1 Select 3-2
- Click 540, 560 ; Selects 2-3
- Sleep 3000
- Click 1048, 690, 1 ; Confirm Stage Select
- Sleep 3000
- Click 722, 270, 1 ; Select Fleet 3
- Sleep 3000
- Click 983, 694 ; Begin Sortie-
- Sleep 3000
- While (compass_check() = 0) { ; Wait till compass is out
- Sleep 1000
- }
- Sleep 1500
- Click 232, 696, 1 ; Spin the compass (click on bottom left corner)
- shutsugeki_chuu := 1 ; Currently in sortie. Keep clicking/checking till out of sortie.
- While (shutsugeki_chuu = 1) {
- Sleep 3000
- Click 232, 696, 1 ; Click in the corner
- if retreat_decision() {
- Click 540, 412, 1 ; Click left button to skip night battle / continue sortie
- Sleep 3000
- } else if home_screen_check() {
- shutsugeki_chuu := 0
- }
- }
- if (expedition_trigger = 1) {
- expedition_complete_check() ; Check if expeditions are done. Deal with popups if they are
- expedition_complete_check() ; One more check just in case another expedition completed during the first one
- expedition_refuel() ; Refuel expedition fleets
- expedition_complete_check() ; One more check in case another expedition completed dring refuel
- expedition_refuel() ; Another refuel attempt for the check one line above
- expedition_send() ; Send out fleets to expedition
- expedition_complete_check() ; Anoother check just in case expedition completes during prior send
- expedition_refuel() ; Another refuel attempt for the check one line above
- expedition_send() ; Another send out attempt for the check two lines above
- }
- Click 275, 401, 1 ; Click Resupply
- Sleep 3000
- Click 445, 271, 1 ; Click 3rd fleet
- Sleep 3000
- Click 330, 271, 1 ; Click select all ships for resupply
- Sleep 2500
- Click 1075, 685, 1 ; Resupply ships
- Sleep 11000
- Click 197, 526, 1 ; Click on Dock
- Sleep 6000
- Click 501, 328 ; Click on First Dock
- Sleep 5000
- ; Check if ship is in green health or not
- ship_is_healthy := 0
- MouseMove 30, 430, 1 ; Moves mouse out of the way
- PixelSearch first_slot_x, first_slot_y, 974, 287, 989, 300, 0x00FF00, 0, fast
- if (first_slot_y < 299) { ; Check if shutsugeki button is present
- ship_is_healthy := 1
- }
- if (ship_is_healthy = 0) {
- Click 838, 296, 1 ; Click the first ship
- Sleep 3000
- Click 1060, 680 ; Begin docking
- Sleep 3000
- Click 823, 631 ; Confirm Docking
- Sleep 15000
- While (ship_is_healthy = 0) {
- MouseMove 30, 430, 1 ; Moves mouse out of the way
- Sleep 5000
- PixelSearch repairing_x, repairing_y, 1135, 291, 1159, 313, 0x36D1B3, 10, fast
- if (repairing_y < 312) { ; Check if ship is being repaired
- ship_is_repairing := 1
- } else {
- ship_is_repairing := 0
- }
- if (ship_is_repairing = 0) {
- PixelSearch healthy_x, healthy_y, 1137, 307, 1146, 313, 0xD4C3A9, 8, fast
- if (healthy_y < 312) { ; Check if ship is no longer in dock and is done being repaired
- ship_is_healthy := 1
- }
- }
- }
- }
- Click 267, 448, 1 ; Click back to home
- Sleep 6000
- if (expedition_trigger = 1) {
- expedition_complete_check() ; Check if expeditions are done. Deal with popups if they are
- expedition_complete_check() ; One more check just in case another expedition completed during the first one
- expedition_refuel() ; Refuel expedition fleets
- expedition_complete_check() ; One more check in case another expedition completed dring refuel
- expedition_refuel() ; Another refuel attempt for the check one line above
- expedition_send() ; Send out fleets to expedition
- expedition_complete_check() ; Anoother check just in case expedition completes during prior send
- expedition_refuel() ; Another refuel attempt for the check one line above
- expedition_send() ; Another send out attempt for the check two lines above
- }
- }
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement