Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Simple KanColle expedition and Leveling script.
- Constantly runs and repairs ships ships and can run in three modes:
- Solo ship (sub) running 2-3 for levels and fuel, 3-2 for levels and steel,
- or Fleet of ships (hopefully with 1 or more subs) running 3-2-A for levels
- Also runs Expedition 2 (Steel and buckets) on Fleet 2,
- and Expedition 5 (Fuel) on Fleet 4.
- Ctrl+Alt+o to start script and respond to the prompts accordingly.
- Ctrl+Alt+p to pause the script at any time
- This script relies on relative mouse coordinates. Therefore to keep screen
- resolution consistent, this script must be run on Adobe Flash Projector
- with the game in native resolution. Get Adobe Flash Projector here:
- http://www.adobe.com/support/flashplayer/downloads.html
- Run the game through your API link with Adobe Flash Projector and be
- sure not to resize the window. Note that after hitting Game Start
- the Adobe Flash Projector menu bar should disappear leaving a black region
- on the top and bottom akin to a letterbox. Leave these be.
- Finally this script scans pixel colors to determine what's happening on the
- screen. Because of this AutoHotkey needs constant data being sent out
- from the computer's graphics unit. Therefore be sure that your computer is
- not turning off display output after a certain amount of time. For Windows
- users go to Control Panel > Power Options > Change (current) plan settings >
- Turn off the display > Never . It's fine, however, to turn off your monitor
- so long as data from your graphics unit is still being sent by setting this
- option to Never.
- */
- !^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
- /*
- ##### Functions #####
- */
- rand_sleep(time_low, time_high) { ; Probably unnecessary, but set sleep to be semi-random to alleviate some banhammer suspicion. Not like this is really detectable-
- Random, rand, %time_low%, %time_high% ; Generate sleep time between time_low and time_high in ms
- Sleep %rand% ; Sleep the generated time
- }
- 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, 207, 281, 218, 295, 0x209BFB, 2, fast
- if (shutsugeki_y < 294) { ; Check if shutsugeki button is present
- shutsugeki_ok := 1
- }
- PixelSearch ammo_x, ammo_y, 695, 94, 730, 105, 0xF2F6FF, 15, fast
- if (ammo_y < 104) { ; Check if ammo stats are present
- ammo_ok := 1
- }
- PixelSearch config_x, config_y, 776, 485, 791, 497, 0xF2F6FF, 2, fast
- if (config_y < 496) { ; Check if config button is present
- config_ok := 1
- }
- condition_check := shutsugeki_ok + ammo_ok + config_ok
- if (condition_check = 3) {
- return 1
- } else {
- return 0
- }
- }
- sortie_menu_check() ; Checks if you're stuck in the stage select screen for some reason
- {
- MouseMove 30, 430, 1 ; Moves mouse out of the way
- PixelSearch shutsugeki_x, shutsugeki_y, 20, 482, 52, 506, 0xF2F6FF, 5, fast
- if (shutsugeki_y < 505) { ; Check if shutsugeki button is present
- shutsugeki_ok := 1
- }
- PixelSearch ammo_x, ammo_y, 695, 94, 730, 105, 0xF2F6FF, 15, fast
- if (ammo_y < 104) { ; Check if ammo stats are present
- ammo_ok := 1
- }
- condition_check := shutsugeki_ok + ammo_ok
- if (condition_check = 2) {
- return 1
- } else {
- return 1
- }
- }
- 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, 405, 248, 412, 262, 0x08088F, 15, fast
- if (center_compass_y < 261) { ; Check if shutsugeki button is present
- center_compass_ok := 1
- }
- PixelSearch corner_compass_x, corner_compass_y, 56, 463, 65, 477, 0x05073F, 15, fast
- if (corner_compass_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
- }
- }
- formation_select_check() ; Checks if the current screen is the formation selection screen
- {
- MouseMove 30, 430, 1 ; Moves mouse out of the way
- PixelSearch corner_compass_x, corner_compass_y, 56, 463, 65, 477, 0x07098C, 15, fast
- if (corner_compass_y < 476) { ; Check if corner compass is present
- corner_compass_ok := 1
- }
- PixelSearch line_ahead_dot_x, line_ahead_dot_y, 447, 146, 460, 158, 0x83FF5D, 5, fast
- if (line_ahead_dot_y < 157) { ; Check if green dot in line ahead formation is present
- line_ahead_dot_ok := 1
- }
- PixelSearch diamond_dot_x, diamond_dot_y, 711, 160, 722, 170, 0x83FF5D, 5, fast
- if (diamond_dot_y < 169) { ; Check if green dot in diamond formation is present
- diamond_dot_ok := 1
- }
- PixelSearch echelon_text_x, echelon_text_y, 515, 379, 530, 395, 0xF2F6FF, 5, fast
- if (echolon_text_y < 394) { ; Check echelon white text is present
- echelon_test_ok := 1
- }
- condition_check := corner_compass_ok + line_ahead_dot_ok + diamond_dot_ok + echelon_test_ok
- if (condition_check = 4) { ; Check if all are present
- return 1
- } else {
- return 0
- }
- }
- night_battle_decision() ; Checks if the current screen is the night battle decision screen
- {
- MouseMove 30, 430, 1 ; Moves mouse out of the way
- PixelSearch retreat_x, retreat_y, 281, 267, 301, 288, 0xFFFFFF, 5, fast
- if (retreat_y < 287) { ; Check if left button is present
- retreat_button_ok := 1
- }
- PixelSearch night_x, night_y, 500, 266, 520, 288, 0xFFFFFF, 5, fast
- if (night_y < 287) { ; Check if right button is present
- night_battle_ok := 1
- }
- PixelSearch blue_gear_x, blue_gear_y, 18, 68, 36, 91, 0xC0BD1D, 5, fast
- if (blue_gear_y < 90) { ; Check if top left gear is present
- blue_gear_ok := 1
- }
- PixelSearch gray_bar_x, gray_bar_y, 153, 78, 163, 92, 0x2B2A26, 5, fast
- if (gray_bar_y < 91) { ; Check if top left gray background is present
- gray_bar_ok := 1
- }
- condition_check := retreat_button_ok + night_battle_ok + blue_gear_ok + gray_bar_ok
- if (condition_check = 4) {
- 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, 281, 267, 301, 288, 0xFFFFFF, 5, fast
- if (retreat_y < 287) { ; Check if left button is present
- retreat_button_ok := 1
- }
- PixelSearch night_x, night_y, 500, 266, 520, 288, 0xFFFFFF, 5, fast
- if (night_y < 287) { ; Check if right button is present
- night_battle_ok := 1
- }
- ; PixelSearch blue_gear_x, blue_gear_y, 18, 68, 36, 91, 0xC0BD1D, 5, fast
- ; if (blue_gear_y < 90) { ; Check if top left gear is present
- ; blue_gear_ok := 1
- ; }
- ; PixelSearch gray_bar_x, gray_bar_y, 153, 78, 163, 92, 0x2B2A26, 5, fast
- ; if (gray_bar_y < 91) { ; Check if top left gray background is present
- ; gray_bar_ok := 1
- ; }
- condition_check := retreat_button_ok + night_battle_ok ; + blue_gear_ok + gray_bar_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
- {
- MsgBox, %expedition_1_timer_complete%
- if (expedition_1_timer_complete = 1) { ; expedition 1 end check
- Click 52, 492, 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
- rand_sleep(2500, 3500)
- Click 52, 492, 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 52, 492, 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
- rand_sleep(2500, 3500)
- Click 52, 492, 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 87, 259, 1 ; Click Resupply
- rand_sleep(7500, 8500)
- if (expedition_1_fuel_pending = 1) {
- Click 188, 159, 1 ; Click 2nd fleet
- rand_sleep(4500, 5500)
- Click 128, 160, 1 ; Click select all ships for resupply
- rand_sleep(2500, 3500)
- Click 708, 482, 1 ; Resupply fleet 2 ships
- rand_sleep(9500, 10500)
- expedition_1_dispatch_pending := 1
- expedition_1_fuel_pending := 0
- }
- if (expedition_2_fuel_pending = 1) {
- Click 247 161, 1 ; Click 4th fleet
- rand_sleep(4500, 5500)
- Click 128, 160, 1 ; Click select all ships for resupply
- rand_sleep(3000, 4000)
- Click 708, 482, 1 ; Resupply fleet 4 ships
- rand_sleep(9500, 10500)
- expedition_2_dispatch_pending := 1
- expedition_2_fuel_pending := 0
- }
- Click 83, 296, 1 ; Return to home
- rand_sleep(8000, 9000)
- }
- }
- 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 210, 294, 1 ; Click on Shutsugeki button in home
- rand_sleep(5500, 6500)
- Click 686, 265, 1 ; Click on Expedition button
- rand_sleep(6500, 7500)
- if (expedition_1_dispatch_pending = 1) {
- Click 218, 247, 1 ; Select Expedition 2
- rand_sleep(4500, 5500)
- Click 218, 247, 1 ; Confirm Expedition 2
- rand_sleep(4500, 5500)
- Click 403, 172, 1 ; Select Fleet 2
- rand_sleep(5500, 6500)
- Click 635, 489, 1 ; Send out Fleet 2
- rand_sleep(1500, 3500)
- SetTimer, expedition_1, -1800000
- expedition_1_dispatch_pending := 0
- rand_sleep(8000, 9000)
- }
- rand_sleep(2000, 3000)
- if (expedition_2_dispatch_pending = 1) {
- Click 218, 335, 1 ; Select Expedition 5
- rand_sleep(4500, 5500)
- Click 688, 485, 1 ; Confirm Expedition 5
- rand_sleep(4500, 5500)
- Click 462, 170, 1 ; Select Fleet 4
- rand_sleep(5500, 6500)
- Click 635, 489, 1 ; Send out Fleet 4
- rand_sleep(1500, 3500)
- SetTimer, expedition_2, -5400000
- expedition_2_dispatch_pending := 0
- rand_sleep(8000, 9000)
- }
- Click 83, 296, 1 ; Return to home
- rand_sleep(8000, 9000)
- }
- }
- convert_time(time) ; Converts user inputted HH:MM:SS to ms for timer function
- {
- hours := SubStr(%time%, 1, 2)
- hours_ms := hours*60*60*1000
- minutes := SubStr(%time%, 4, 2)
- minutes_ms := minutes*60*1000
- seconds := SubStr(%time%, 7, 2)
- seconds_ms := seconds*1000
- total_time_ms := hours_ms + minutes_ms + seconds_ms
- return %total_time_ms%
- }
- /*
- ##### End Functions #####
- */
- !^o::
- 3_2_message := 0 ; Flag to check whether the user has input a valid input
- While (3_2_message = 0) { ; Keep asking user until a valid input
- InputBox, sortie_mode_input, Select Sortie Mode, Do you want to run 2-3 for sub leveling and fuel`, 3-2 for sub leveling and steel or 3-2-A for levels. Use solo ship for 2-3 and 3-2. Team is okay for 3-2-A. Suggest a sub for all.`nA for 2-3 sub leveling and fuel. `nB for 3-2 sub leveling and steel`nC for 3-2-A Leveling.
- if (sortie_mode_input = "A" OR sortie_mode_input = "B" OR sortie_mode_input = "C") { ; Proceed if A, B, or C
- 3_2_message := 1 ; Proceed outside the while loop.
- } else {
- MsgBox, Invalid Input. Please put either A for 2-3 runs, B for 3-2 runs, or C for 3-2-A runs. Stop anytime with Ctrl+Alt+p.
- }
- }
- expedition_message := 0 ; Flag to check whether the user has input a valid input to run expeditions or not
- While (expedition_message = 0) { ; Keep asking user until a valid input
- InputBox, expedition_trigger, Select Expedition Mode, Do you want to run expeditions on Fleets 2 and 4 as well?`nY/N ; Ask user whether to run expeditions on Fleets 2 and 4
- if (expedition_trigger = "Y" OR expedition_trigger = "N") { ; Proceed if Y or N
- expedition_message := 1 ; Escape while loop if Y or N
- } else { ; If the user put an invalid input
- MsgBox, Invalid Input. Please put either Y for Yes (will run expeditions) or N for No (Will not run expeditions). Stop anytime with Ctrl+Alt+p.
- }
- }
- if (expedition_trigger = "Y") { ; Expedition trigger. before Ctrl + Alt + o to include expeditions
- expedition_1_message := 0 ; Flag to check whether the user has input a valid input for Fleet 2 remaining time
- While (expedition_1_message = 0) { ; Keep asking for Fleet 2 Remaining time until a valid input
- InputBox, expedition_1_remaining_input, Fleet 2 Expedition Remaining Time, Please input the remaining time until Fleet 2's expedition time is over.`nInput 0 if Fleet 2 is already home and ready for expedition 2. `nInput format HH:MM:SS
- expedition_1_remaining_ms := convert_time(%expedition_1_remaining_input%) ; Convert remaining time from HH:MM:SS to ms for timer
- if (expedition_1_remaining_ms>=0) { ; If we get a time value in milliseconds
- SetTimer, expedition_1, -%expedition_1_remaining_ms% ; Set the timer for when expeditions are over
- expedition_1_message := 1 ; And proceed outside the while loop
- } else if (expedition_1_remaining_input = 0) { ; If the user inputs 0
- SetTimer, expedition_1, -0 ; Set the timer to 0, and Fleet 2 will be sent out during expedition phase
- expedition_1_message :=1 ; Proceed out of the while loop
- } else { ; If the user put an invalid format
- MsgBox, Invalid Input. Please input the remaining time for Fleet 2 to return in HH:MM:SS format. Stop anytime with Ctrl+Alt+p.
- }
- }
- expedition_2_message := 0 ; Flag to check whether the user has input a valid input for Fleet 4 remaining time
- While (expedition_2_message = 0) {
- InputBox, expedition_2_remaining_input, Fleet 4 Expedition Remaining Time, Please input the remaining time until Fleet 4's expedition time is over.`nInput 0 if Fleet 4 is already home and ready for expedition 5. `nInput format HH:MM:SS
- expedition_2_remaining_ms := convert_time(%expedition_2_remaining_input%) ; Convert remaining time from HH:MM:SS to ms for timer
- if (expedition_2_remaining_ms>=0) {
- SetTimer, expedition_2, -%expedition_2_remaining_ms%
- expedition_2_message := 1
- } else if (expedition_2_remaining_input = 0) {
- SetTimer, expedition_2, -0
- expedition_2_message :=1
- } else {
- MsgBox, Invalid Input. Please input the remaining time for Fleet 4 to return in HH:MM:SS format. Stop anytime with Ctrl+Alt+p.
- }
- }
- }
- While (1>0) { ; Run this forever~
- IfWinExist, Adobe Flash Player ; Make sure Adobe Flash Player is activated
- WinActivate, Adobe Flash Player
- While (home_screen_check() = 0) {
- rand_sleep(1000, 1100)
- }
- Click 210, 294, 1 ; Click on Shutsugeki button in home
- rand_sleep(3000, 4000)
- Click 240, 265, 1 ; Shutsugeki~
- rand_sleep(3000, 4000)
- if (sortie_mode_input = "B" OR sortie_mode_input = "C") {
- Click 316, 488, 1 ; Select Stage 3
- rand_sleep(3000, 4000)
- Click 631, 248, 1 Select 3-2
- rand_sleep(3000, 4000)
- } else {
- Click 243, 482 ; Select Stage 2
- rand_sleep(3000, 4000)
- Click 292, 387 ; Selects 2-3
- rand_sleep(3000, 4000)
- }
- Click 685, 487, 1 ; Confirm Stage Select
- rand_sleep(3000, 4000)
- Click 435, 158, 1 ; Select Fleet 3
- rand_sleep(3000, 4000)
- Click 633, 487 ; Begin Sortie-
- rand_sleep(3000, 4000)
- sortie_menu_check_flags := 0 ; Get too many and we're probably stuck
- While (compass_check() = 0) { ; Wait till compass is out
- rand_sleep(1000, 1500)
- if (sortie_menu_check() = 1) { ; Check if we're stuck in the sortie menu. Escape if we are
- sortie_menu_check_flags := sortie_menu_check_flags + 1
- if (sortie_menu_check_flags > 10) { ; We stuck
- Click 56, 84, 1 ; Click the big blue orb in the corner to go back to home
- rand_sleep(7000,9000)
- break ; Get out of the compass check loop
- }
- }
- if (home_screen_check() = 1) { ; In case something weird happened and we're still in the home screen
- rand_sleep(4000,5000)
- break ; Get out of the compass check loop
- }
- }
- rand_sleep(1500, 2500)
- Click 52, 492, 1 ; Spin the compass (click on bottom left corner)
- if (sortie_mode_input = "C") { ; Run the 3-2-A leveling loop
- shutsugeki_chuu := 1 ; Currently in sortie. Keep clicking/checking till out of sortie.
- While (shutsugeki_chuu = 1) {
- rand_sleep(3000, 5000)
- Click 52, 492, 1 ; Click in the corner
- if (formation_select_check() = 1) { ; Check if we're currently in the formation selection screen
- Click 655, 390, 1 ; Select the Line Abreast formation for survivability
- rand_sleep(5000, 6000)
- }
- if retreat_decision() {
- rand_sleep(1500,2500)
- if night_battle_decision() { ; Check if it's actually the night battle decision
- Click 290, 275, 1 ; Click left button to skip night battle
- rand_sleep(1000,2000)
- } else if retreat_decision() { ; Check again just to make sure it's an actual decision
- Click 510, 277, 1 ; Retreat after 3-2-A
- }
- rand_sleep(3000, 5000)
- } else if home_screen_check() {
- shutsugeki_chuu := 0
- }
- }
- } else { ; Run the 2-3 or 3-2 solo sub leveling and resource gathering loop
- shutsugeki_chuu := 1 ; Currently in sortie. Keep clicking/checking till out of sortie.
- While (shutsugeki_chuu = 1) {
- rand_sleep(3000, 5000)
- Click 52, 492, 1 ; Click in the corner
- if retreat_decision() {
- Click 290, 275, 1 ; Click left button to skip night battle / continue sortie
- rand_sleep(3000, 5000)
- } else if home_screen_check() {
- shutsugeki_chuu := 0
- }
- }
- }
- if (expedition_trigger = "Y") {
- 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 87, 259, 1 ; Click Resupply
- rand_sleep(5000, 7000)
- Click 216, 163, 1 ; Click 3rd fleet
- rand_sleep(3000, 5000)
- Click 128, 160, 1 ; Click select all ships for resupply
- rand_sleep(2500, 4000)
- Click 708, 482, 1 ; Resupply ships
- rand_sleep(11000, 13000)
- /*
- ##### Repairing #####
- */
- Click 28, 355, 1 ; Click on Dock
- rand_sleep(7000, 9000)
- MouseMove 52, 492, 1
- empty_dock := 0
- dock_1_empty := 0 ; Assume dock 1 is full first
- dock_2_empty := 0 ; Assume dock 2 is full first
- While (empty_dock = 0) { ; Assuming only 2 docks available, wait till the dock is completely empty
- MouseMove 52, 492, 1
- PixelSearch dock_1_empty_x, dock_1_empty_y, 756, 188, 762, 194, 0xD4C3A9, 8, fast ; Check dock 1 if it's empty or not
- if (dock_1_empty_y < 193) {
- dock_1_empty := 1 ; Dock 1 is empty
- }
- PixelSearch dock_2_empty_x, dock_2_empty_y, 756, 253, 768, 268, 0xEDDAAB, 13, fast ; Check dock 2 if it's empty or not
- if (dock_2_empty_y < 267) {
- dock_2_empty := 1 ; Dock 2 is empty
- }
- if (dock_1_empty = 1 AND dock_2_empty = 1) { ; Check if dock slots 1 and 2 are empty
- empty_dock := 1 ; Proceed out of the loop if dock slots 1 and 2 are empty
- }
- rand_sleep(5000, 6000)
- }
- ships_are_healthy := 0 ; Assume there's a damaged ship
- repairing_ship_pos_1 := 0 ; Assume that the dock isn't currently repairing any ships
- repairing_ship_pos_2 := 0 ; So slots 2 and 3 aren't in the
- repairing_ship_pos_3 := 0 ; Repairing state
- dock_1_repairing_pos_1 := 0 ; Dock 1 is not repairing anything in position 1
- dock_1_repairing_pos_2 := 0 ; Or in position 2
- dock_2_repairing_pos_1 := 0 ; Dock 2 is not repairing anything in position 1
- dock_2_repairing_pos_2 := 0 ; Or in position 2
- final_ship_repairing := 0
- While (ships_are_healthy = 0) { ; Loop until all ships are healthy
- if (final_ship_repairing = 0) { ; If there's more than the last one ship being repaired
- if (dock_1_empty = 1) {
- Click 259, 205, 1 ; Click on the empty dock 1
- dock_1_selected := 1 ; Mark selected dock
- } else if (dock_2_empty = 1) {
- Click 263, 285, 1 ; Or click on the empty dock 2
- dock_2_selected := 1 ; Mark selected dock
- }
- }
- rand_sleep(5000,6000)
- MouseMove 52, 492, 1 ; Moves mouse out of the way
- if (dock_1_selected = 1 OR dock_2_selected = 1) {
- PixelSearch slot_1_x, slot_1_y, 626, 174, 634, 184, 0x00FF00, 0, fast
- if (slot_1_y < 183) { ; Check if first slot is damaged or not
- healthy_ship_pos_1 := 1 ; Healthy ship in position 1
- } else {
- damaged_ship_pos_1 := 1 ; Damaged ship in position 1
- }
- PixelSearch slot_2_x, slot_2_y, 626, 205, 634, 215, 0x00FF00, 0, fast
- if (slot_2_y < 214) { ; Check if second slot is damaged or not
- healthy_ship_pos_2 := 1 ; Healthy ship in position 2
- } else {
- damaged_ship_pos_2 := 1 ; Damaged ship in position 2
- }
- PixelSearch slot_3_x, slot_3_y, 626, 235, 634, 245, 0x00FF00, 0, fast
- if (slot_3_y < 244) { ; Check if third slot is damaged or not
- healthy_ship_pos_3 := 1 ; Healthy ship in position 3
- } else {
- damaged_ship_pos_3 := 1 ; Damaged ship in position 3
- }
- if (damaged_ship_pos_1 AND repairing_ship_pos_1 AND healthy_ship_pos_2) { ; Check if the last ship is repairing
- final_ship_repairing := 1 ; Last ship repairing. Wait for it to finish
- Click 259, 205, 1 ; Slide out the select ship to repair tab
- rand_sleep(5000,8000)
- continue ; Go back and wait for the final ship
- }
- if (healthy_ship_pos_1 = 1 AND healthy_ship_pos_2 = 1 AND healthy_ship_pos_3 = 1) { ; If all ships are healthy
- final_ship_repairing := 1 ; Set to skip dock clicking check
- Click 259, 205, 1 ; Slide out the select ship to repair tab
- rand_sleep(5000,8000)
- continue ; Go back and get to the final check
- }
- if (damaged_ship_pos_1 = 1 AND repairing_ship_pos_1 = 0) { ; If there's a damaged ship in position 1 and no dock is repairing it
- Click 502, 181, 1 ; Click the first ship
- rand_sleep(3000, 5000)
- Click 696, 480 ; Begin docking
- rand_sleep(3000, 5000)
- Click 511, 442 ; Confirm Docking
- rand_sleep(15000, 20000)
- if (dock_1_selected = 1) { ; Change currently selected dock 1 state
- While (dock_1_empty = 1) { ; Wait till Dock 1 is actually repairing
- PixelSearch repairing_1_x, repairing_1_y, 752, 177, 771, 195, 0x36D1B3, 10, fast
- if (repairing_1_y < 194) { ; Check if ship is actually being repaired
- repairing_ship_pos_1 := 1 ; Position 1 being repaired
- dock_1_repairing_pos_1 := 1 ; Dock 1 is repairing position 1
- dock_1_empty := 0 ; Dock 1 no longer empty
- dock_1_selected := 0 ; Dock 1 no longer selected
- }
- }
- } else if (dock_2_selected = 1) { ; change currently selected dock 2 state
- While (dock_2_empty = 1) { ; Wait till Dock 2 is actually repairing
- PixelSearch repairing_2_x, repairing_2_y, 758, 255, 768, 268, 0x36D1B3, 8, fast ; ***************************
- if (repairing_y < 194) { ; Check if ship is actually being repaired *************
- repairing_ship_pos_1 := 1 ; Position 1 being repaired
- dock_2_repairing_pos_1 := 1 ; Dock 2 is repairing position 1
- dock_2_empty := 0 ; Dock 2 no longer empty
- dock_2_selected := 0 ; Dock 2 no longer selected
- }
- }
- }
- } else if (damaged_ship_pos_2 = 1 AND repairing_ship_pos_2 = 0) { ; If there's a damaged ship in position 2 and no dock is repairing it
- Click 448, 213, 1 ; Click the second ship
- rand_sleep(3000, 5000)
- Click 696, 480 ; Begin docking
- rand_sleep(3000, 5000)
- Click 511, 442 ; Confirm Docking
- rand_sleep(15000, 20000)
- if (dock_1_selected = 1) { ; Change currently selected dock 1 state
- While (dock_1_empty = 1) { ; Wait till Dock 1 is actually repairing
- PixelSearch repairing_1_x, repairing_1_y, 752, 177, 771, 195, 0x36D1B3, 10, fast
- if (repairing_1_y < 194) { ; Check if ship is actually being repaired
- repairing_ship_pos_2 := 1 ; Position 2 being repaired
- dock_1_repairing_pos_2 := 1 ; Dock 1 is repairing position 2
- dock_1_empty := 0 ; Dock 1 no longer empty
- dock_1_selected := 0 ; Dock 1 no longer selected
- }
- }
- } else if (dock_2_selected = 1) { ; change currently selected dock 2 state
- While (dock_2_empty = 1) { ; Wait till Dock 2 is actually repairing
- PixelSearch repairing_2_x, repairing_2_y, 758, 255, 768, 273, 0x36D1B3, 8, fast
- if (repairing_y < 272) { ; Check if ship is actually being repaired
- repairing_ship_pos_2 := 1 ; Position 2 being repaired
- dock_2_repairing_pos_2 := 1 ; Dock 2 is repairing position 2
- dock_2_empty := 0 ; Dock 2 no longer empty
- dock_2_selected := 0 ; Dock 2 no longer selected
- }
- }
- }
- }
- }
- MouseMove 52, 492, 1
- rand_sleep(1000,1500)
- if (dock_1_empty = 0) { ; If dock 1 is occupied, check if repairs have finished and it has become empty
- PixelSearch dock_1_empty_x, dock_1_empty_y, 756, 188, 762, 194, 0xD4C3A9, 8, fast ; Check dock 1 if it's empty or not
- if (dock_1_empty_y < 193) {
- dock_1_empty := 1 ; Repairs have finished and dock 1 is now empty
- if (dock_1_repairing_pos_1 = 1) { ; If dock 1 was repairing position 1, move position 2 up
- dock_1_repairing_pos_1 := 0 ; Dock 1 finished repairing position 1
- repairing_ship_pos_1 := 0 ; Position 1 might not be being repaired anymore
- if (repairing_ship_pos_2 = 1) { ; But if position 2 was under repair
- repairing_ship_pos_1 := 1 ; Position 2 becomes position 1 and is now under repair
- repairing_ship_pos_2 := 0 ; And position 2 is now no longer under repair
- dock_2_repairing_pos_1 := 1 ; Likewise dock 2 is now repairing position 1
- dock_2_repairing_pos_2 := 0 ; And dock 2 is no longer repairing position 2
- }
- } else if (dock_1_repairing_pos_2 = 1) { ; If dock 1 was repairing position 2
- dock_1_repairing_pos_2 := 0 ; Dock 1 is no longer repairing position 2
- repairing_ship_pos_2 := ; Position 2 is no longer under repair
- }
- }
- }
- if (dock_2_empty = 0) { ; If dock 2 is occupied, check if repairs have finished and it has become empty
- PixelSearch dock_2_empty_x, dock_2_empty_y, 756, 253, 768, 268, 0xEDDAAB, 13, fast ; Check dock 2 if it's empty or not
- if (dock_2_empty_y < 267) {
- dock_2_empty := 1 ; Repairs have finished and dock 2 is now empty
- if (dock_2_repairing_pos_1 = 1) { ; If dock 2 was repairing position 1, move position 2 up
- dock_2_repairing_pos_1 := 0 ; Dock 2 finished repairing position 1
- repairing_ship_pos_1 := 0 ; Position 1 might not be being repaired anymore
- if (repairing_ship_pos_2 = 1) { ; But if position 2 was under repair
- repairing_ship_pos_1 := 1 ; Position 2 becomes position 1 and is now under repair
- repairing_ship_pos_2 := 0 ; And position 2 is now no longer under repair
- dock_1_repairing_pos_1 := 1 ; Likewise dock 1 is now repairing position 1
- dock_1_repairing_pos_2 := 0 ; And dock 1 is no longer repairing position 2
- }
- } else if (dock_2_repairing_pos_2 = 1) { ; If dock 2 was repairing position 2
- dock_2_repairing_pos_2 := 0 ; Dock 2 is no longer repairing position 2
- repairing_ship_pos_2 := ; Position 2 is no longer under repair
- }
- }
- }
- rand_sleep(4000,5000)
- if (dock_1_empty = 1 AND dock_2_empty = 1) { ; Final health check
- Click 259, 205 ; Select an arbitrary dock to see the repair ship select screen
- rand_sleep(6000,8000)
- PixelSearch slot_1_x, slot_1_y, 626, 174, 634, 184, 0x00FF00, 0, fast
- if (slot_1_y < 183) { ; Check if first slot is damaged or not
- healthy_ship_pos_1 := 1 ; Healthy ship in position 1
- } else {
- damaged_ship_pos_1 := 1 ; Damaged ship in position 1
- final_ship_repairing := 0 ; Unset final ship flag if it was somehow turned on
- }
- PixelSearch slot_2_x, slot_2_y, 626, 205, 634, 215, 0x00FF00, 0, fast
- if (slot_2_y < 214) { ; Check if second slot is damaged or not
- healthy_ship_pos_2 := 1 ; Healthy ship in position 2
- } else {
- damaged_ship_pos_2 := 1 ; Damaged ship in position 2
- final_ship_repairing := 0 ; Unset final ship flag if it was somehow turned on
- }
- PixelSearch slot_3_x, slot_3_y, 626, 235, 634, 245, 0x00FF00, 0, fast
- if (slot_3_y < 244) { ; Check if third slot is damaged or not
- healthy_ship_pos_3 := 1 ; Healthy ship in position 3
- } else {
- damaged_ship_pos_3 := 1 ; Damaged ship in position 3
- final_ship_repairing := 0 ; Unset final ship flag if it was somehow turned on
- }
- healthy_check := healthy_ship_pos_1 + healthy_ship_pos_2 + healthy_ship_pos_3
- if (healthy_check = 3) {
- ships_are_healthy := 1
- }
- Click 259, 205 ; Slide out repair ship selection
- rand_sleep(5000, 6000)
- }
- if (expedition_trigger = "Y") { ; If expeditions are done may as well complete them while waiting on repairs
- if (expedition_1_timer_complete = 1 OR expedition_2_timer_complete = 1) { ; Check if any expeditions are complete
- Click 56, 84, 1 ; Click the big blue orb in the corner to go back to home
- rand_sleep(8000,10000)
- 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 131, 403, 1 ; Return to the docks and continue repairing
- rand_sleep(8000,10000)
- }
- }
- }
- /*
- ##### End Repairing #####
- */
- Click 83, 296, 1 ; Click back to home
- rand_sleep(6000, 8000)
- if (expedition_trigger = "Y") {
- 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
Add Comment
Please, Sign In to add comment