Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MenuHelper spamming hmn/cpu swap in character select #99

Open
dalton-avery opened this issue Dec 1, 2023 · 0 comments · May be fixed by #102
Open

MenuHelper spamming hmn/cpu swap in character select #99

dalton-avery opened this issue Dec 1, 2023 · 0 comments · May be fixed by #102

Comments

@dalton-avery
Copy link

When selecting characters, after the cpu character is selected and the level is set, it navigates to the hmn/cpu toggle and spam clicks it. This blocks the autostart of the game if using that controller to autostart.

If there are two controllers, one for a training AI and one to select a cpu character, the AI Controller will start the game before the 2nd controller has toggled the character to a cpu and set its level, causing the game to be with two players. For each round start after this, it will change it to cpu but not set the level prior to the game starting.

Script to reproduce spamming:

import melee, os

ISO_PATH = os.getenv('ISO_PATH')
SLIPPI_PATH = os.getenv('SLIPPI_PATH')

console = melee.console.Console(path=SLIPPI_PATH, fullscreen=False)

controller = melee.controller.Controller(console, port=1, type=melee.ControllerType.STANDARD)

console.run(iso_path=ISO_PATH)

console.connect()

controller.connect()

gamestate = console.step()

while gamestate.menu_state != melee.Menu.IN_GAME:
    gamestate = console.step()
    if gamestate is None:
        continue

    melee.MenuHelper.menu_helper_simple(
        gamestate=gamestate,
        controller=controller,
        character_selected=melee.Character.CPTFALCON,
        stage_selected=melee.Stage.BATTLEFIELD,
        connect_code="",
        cpu_level=9,
        costume=0,
        autostart=False,
        swag=False
    )

Script to reproduce game starting without cpu/cpulevel selected:

import melee, os

ISO_PATH = os.getenv('ISO_PATH')
SLIPPI_PATH = os.getenv('SLIPPI_PATH')

console = melee.console.Console(
    path=SLIPPI_PATH,
    fullscreen=False
)

controller1 = melee.controller.Controller(console, port=1, type=melee.ControllerType.STANDARD)

controller2 = melee.controller.Controller(console, port=2, type=melee.ControllerType.STANDARD)

console.run(iso_path=ISO_PATH)

console.connect()

controller1.connect()
controller2.connect()

gamestate = console.step()

while gamestate.menu_state != melee.Menu.IN_GAME:
    gamestate = console.step()
    if gamestate is None:
        continue

    melee.MenuHelper.menu_helper_simple(
        gamestate=gamestate,
        controller=controller1,
        character_selected=melee.Character.CPTFALCON,
        stage_selected=melee.Stage.BATTLEFIELD,
        connect_code="",
        cpu_level=0,
        costume=0,
        autostart=True,
        swag=False
    )

    melee.MenuHelper.menu_helper_simple(
        gamestate=gamestate,
        controller=controller2,
        character_selected=melee.Character.DK,
        stage_selected=melee.Stage.BATTLEFIELD,
        connect_code="",
        cpu_level=9,
        costume=0,
        autostart=False,
        swag=False
    )
jjmakes added a commit to jjmakes/libmelee that referenced this issue Jul 15, 2024
@jjmakes jjmakes linked a pull request Jul 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant