TeamREPENTOGON / TeamREPENTOGON/REPENTOGON

ModCallbacks.MC_MENU_INPUT_ACTION not working as expected

Open
#523 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
345
Forks
51
Avg merge
11h 2m
Merged PRs (30d)
4

Description

Issue

I made a function to print which key i press where i'm in the main menu, but it doesn't work.
The problem is that when i'm in the MainMenuType.GAME (where it should check for keypress) it doesn't print anything.
But if i go to the save menu, then back on the main menu again, it always print this key no matter what i press:
ACTION_MENULEFT⚓︎
ACTION_MENURIGHT⚓︎
ACTION_MENUCONFIRM⚓︎

Code
mod = RegisterMod("leggiand", 1)
local isMenu = false
function mod:TestOverride(_, hook, button)
    if not isMenu then
        if pcall(MenuManager.GetActiveMenu) then
            isMenu = false
        else
            print(3)
            return
        end
    end
    local activeMenu = MenuManager.GetActiveMenu()
    if (activeMenu == MainMenuType.GAME) then
        --exclude full screen and mute keys, 
        --because they fire every frame
        if (button ~= 17 and button ~= 18) then
            print(button)
        end
    end
end
mod:AddCallback(ModCallbacks.MC_MENU_INPUT_ACTION,mod.TestOverride)
Video

https://github.com/user-attachments/assets/86ca489c-932c-4b2f-81a0-b78f4ab6f1e3

the extra online tab is only a modified sprite, i'm trying to made an online mode

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the callback behavior with the supplied TestOverride function and inspect MC_MENU_INPUT_ACTION, MenuManager.GetActiveMenu, and MainMenuType.GAME together. Compare the observed button values before and after entering the save menu, using the linked ButtonAction documentation for interpretation. Done means the callback reports the expected menu input consistently in the main menu.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
api, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.