MenuHelper¶
MenuHelper is there to automate away all the tedious menu selections and get you into the game as soon as possible.
Helper functions for navigating the Melee menus in ways that would be cumbersome to do on your own. The goal here is to get you into the game as easily as possible so you don’t have to worry about it. Your AI should concentrate on playing the game, not futzing with menus.
-
class
melee.menuhelper.
MenuHelper
¶ -
change_controller_status
(gamestate, targetport, status, character=None)¶ Switch a given player’s controller to be of the given state
Note
There’s a condition on this you need to know. The way controllers work in Melee, if a controller is plugged in, only that player can make the status go to uplugged. If you’ve ever played Melee, you probably know this. If your friend walks away, you have to press the A button on THEIR controller. (or else actually unplug the controller) No way around it.
-
choose_character
(gamestate, controller, cpu_level=0, costume=2, swag=False, start=False)¶ Choose a character from the character select menu
Parameters: - character (enums.Character) – The character you want to pick
- gamestate (gamestate.GameState) – The current gamestate
- controller (controller.Controller) – The controller object to press buttons on
- cpu_level (int) – What CPU level to set this to. 0 for human/bot controlled.
- costume (int) – The costume index to choose
- swag (bool) – Pick random until you get the character
- start (bool) – Automatically start the match when it’s ready
Note
Intended to be called each frame while in the character select menu
Note
All controller cursors must be above the character level for this to work. The match won’t start otherwise.
-
choose_direct_online
(controller)¶ Helper function to bring us into the direct connect online menu
Parameters: - gamestate (gamestate.GameState) – The current gamestate
- controller (controller.Controller) – The controller to press buttons on
-
choose_stage
(gamestate, controller)¶ Choose a stage from the stage select menu
Intended to be called each frame while in the stage select menu
Parameters: - stage (enums.Stage) – The stage you want to select
- gamestate (gamestate.GameState) – The current gamestate
- controller (controller.Controller) – The controller object to press
-
choose_versus_mode
(controller)¶ Helper function to bring us into the versus mode menu
Parameters: - gamestate (gamestate.GameState) – The current gamestate
- controller (controller.Controller) – The controller to press buttons on
-
enter_direct_code
(controller, connect_code, index)¶ At the nametag entry screen, enter the given direct connect code and exit
Parameters: - gamestate (gamestate.GameState) – The current GameState for this frame
- controller (controller.Controller) – A Controller object to press buttons on
- connect_code (str) – The connect code to direct match with. Leave blank for VS mode.
- index (int) – Current name tag index
Returns: new index (incremented if we entered a new character)
-
inputs_live
= False¶
-
menu_helper_simple
(controller, character_selected, stage_selected, connect_code='', cpu_level=0, costume=0, autostart=False, swag=False)¶ Siplified menu helper function to get you through the menus and into a game
Does everything for you but play the game. Gets you to the right menu screen, picks your character, chooses the stage, enters connect codes, etc…
Parameters: - gamestate (gamestate.GameState) – The current GameState for this frame
- controller (controller.Controller) – A Controller object that the bot will press buttons on
- character_selected (enums.Character) – The character your bot will play as
- stage_selected (enums.Stage) – The stage your bot will choose to play on
- connect_code (str) – The connect code to direct match with. Leave blank for VS mode.
- cpu_level (int) – What CPU level to set this to. 0 for human/bot controlled.
- costume (int) – Costume index chosen
- autostart (bool) – Automatically start the game when it’s ready. Useful for BotvBot matches where no human is there to start it.
- swag (bool) – What it sounds like
-
name_tag_index
= 0¶
-
skip_postgame
()¶ Spam the start button
-