diff --git a/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.cpp b/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.cpp index 69526385f1..f335ff5312 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.cpp @@ -29,6 +29,7 @@ #include "PokemonSV/Programs/Eggs/PokemonSV_EggRoutines.h" #include "PokemonSV/Programs/Boxes/PokemonSV_BoxRelease.h" #include "PokemonSV/Programs/Sandwiches/PokemonSV_SandwichRoutines.h" +#include "PokemonSV/Programs/AutoStory/PokemonSV_MenuOption.h" #include "PokemonSV_EggAutonomous.h" namespace PokemonAutomation{ @@ -736,6 +737,26 @@ void EggAutonomous::save_game(SingleSwitchProgramEnvironment& env, ProController } } +void change_settings_egg_program(SingleSwitchProgramEnvironment& env, ProControllerContext& context, Language language){ + int8_t options_index = 4; + enter_menu_from_overworld(env.program_info(), env.console, context, options_index, MenuSide::RIGHT); + MenuOption session(env.console, context, language); + + std::vector>> options = { + {MenuOptionItemEnum::TEXT_SPEED, {MenuOptionToggleEnum::FAST}}, + {MenuOptionItemEnum::SKIP_MOVE_LEARNING, {MenuOptionToggleEnum::ON}}, + {MenuOptionItemEnum::GIVE_NICKNAMES, {MenuOptionToggleEnum::OFF}}, + {MenuOptionItemEnum::CAMERA_SUPPORT, {MenuOptionToggleEnum::ON}}, + {MenuOptionItemEnum::AUTOSAVE, {MenuOptionToggleEnum::OFF}}, + + }; + session.set_options(options); + + pbf_mash_button(context, BUTTON_A, 1 * TICKS_PER_SECOND); + clear_dialog(env.console, context, ClearDialogMode::STOP_TIMEOUT, 5, {CallbackEnum::PROMPT_DIALOG}); + press_Bs_to_back_to_overworld(env.program_info(), env.console, context); +} + bool EggAutonomous::handle_recoverable_error( SingleSwitchProgramEnvironment& env, ProControllerContext& context, @@ -767,12 +788,12 @@ bool EggAutonomous::handle_recoverable_error( env.log("Don't reset game to protect it.", COLOR_RED); return true; } - + std::string fail_message = e.message(); consecutive_failures++; if (consecutive_failures >= 3){ OperationFailedException::fire( ErrorReport::SEND_ERROR_REPORT, - "Failed 3 times in the row.", + "Failed 3 times in the row.\n" + fail_message, env.console ); } @@ -780,6 +801,10 @@ bool EggAutonomous::handle_recoverable_error( env.log("Reset game to handle recoverable error"); reset_game(env.program_info(), env.console, context); + if (e.message().find("collect_eggs_from_basket") != std::string::npos){ + change_settings_egg_program(env, context, LANGUAGE); + } + return false; } diff --git a/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.h b/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.h index 69de407f5c..a8506f7f85 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.h +++ b/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.h @@ -126,7 +126,7 @@ class EggAutonomous : public SingleSwitchProgramInstance{ bool m_in_critical_to_save_stage = false; }; - +void change_settings_egg_program(SingleSwitchProgramEnvironment& env, ProControllerContext& context, Language language); } diff --git a/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggRoutines.cpp b/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggRoutines.cpp index 92b1df791c..9a51e01412 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggRoutines.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggRoutines.cpp @@ -351,27 +351,65 @@ void collect_eggs_after_sandwich( // Recall your ride to reduce obstacles. pbf_press_button(context, BUTTON_PLUS, 20, 105); +#if 0 + // this sequence will purposefully fail if Camera support is off. + // If we fail to reach the egg basket, we can then check that Camera support is on. + + // Move forward to table + pbf_move_left_joystick(context, 128, 0, 80, 40); + // Move left + pbf_move_left_joystick(context, 0, 128, 40, 40); + // Move forward to pass table + pbf_move_left_joystick(context, 128, 0, 80, 40); + // Move right + pbf_move_left_joystick(context, 255, 128, 40, 85); + // Move back/right to align to basket + pbf_move_left_joystick(context, 240, 255, 40, 40); + + // Move closer to the basket, up to the table + pbf_press_button(context, BUTTON_L, 20, 105); + pbf_move_left_joystick(context, 128, 0, 100, 40); + + // face away from the table + pbf_press_button(context, BUTTON_L, 20, 105); + pbf_move_left_joystick(context, 128, 255, 10, 40); +#endif + #if 1 + // this sequence will work with both Camera Support being Off and On + + // Move forward to table + pbf_move_left_joystick(context, 128, 0, 320ms, 480ms); + // Move left pbf_move_left_joystick(context, 0, 128, 80ms, 480ms); - pbf_press_button(context, BUTTON_L, 120ms, 120ms); + pbf_press_button(context, BUTTON_L, 120ms, 480ms); pbf_move_left_joystick(context, 128, 0, 320ms, 480ms); // Move forward to pass table pbf_move_left_joystick(context, 255, 128, 80ms, 480ms); - pbf_press_button(context, BUTTON_L, 120ms, 120ms); - pbf_move_left_joystick(context, 128, 0, 640ms, 320ms); + pbf_press_button(context, BUTTON_L, 120ms, 480ms); + pbf_move_left_joystick(context, 128, 0, 640ms, 480ms); // Move right pbf_move_left_joystick(context, 255, 128, 80ms, 480ms); - pbf_press_button(context, BUTTON_L, 120ms, 120ms); - pbf_move_left_joystick(context, 128, 0, 320ms, 320ms); + pbf_press_button(context, BUTTON_L, 120ms, 480ms); + pbf_move_left_joystick(context, 128, 0, 320ms, 480ms); - // Move back to face basket - pbf_move_left_joystick(context, 255, 128, 80ms, 320ms); - pbf_press_button(context, BUTTON_L, 120ms, 120ms); - pbf_move_left_joystick(context, 128, 0, 160ms, 320ms); -#else + // Turn right to face basket + pbf_move_left_joystick(context, 255, 128, 80ms, 480ms); + pbf_press_button(context, BUTTON_L, 120ms, 480ms); + + // Move closer to the basket, up to the table + pbf_move_left_joystick(context, 128, 0, 800ms, 480ms); + + // back away from the table, then face forwards towards the basket again + pbf_move_left_joystick(context, 128, 255, 200ms, 480ms); + pbf_move_left_joystick(context, 128, 0, 80ms, 480ms); + pbf_press_button(context, BUTTON_L, 120ms, 480ms); +#endif + +#if 0 // Move left pbf_move_left_joystick(context, 0, 128, 40, 40); // Move forward to pass table diff --git a/SerialPrograms/Source/PokemonSV/Programs/Sandwiches/PokemonSV_SandwichRoutines.cpp b/SerialPrograms/Source/PokemonSV/Programs/Sandwiches/PokemonSV_SandwichRoutines.cpp index 9338e0695d..ab30e2368a 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Sandwiches/PokemonSV_SandwichRoutines.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Sandwiches/PokemonSV_SandwichRoutines.cpp @@ -1105,7 +1105,8 @@ void run_sandwich_maker( stream.log("Read nothing on center plate label."); OperationFailedException::fire( ErrorReport::SEND_ERROR_REPORT, - "No ingredient found on center plate label.", + "run_sandwich_maker: No ingredient found on center plate label.\n" + "Please make sure that you have set the correct Game Language in the program settings.", stream, std::move(screen) );