#✅ | Making navigation easier with keyboard

1 messages · Page 1 of 1 (latest)

elder brook
#

In the main menu of the game, I want the first button (Singleplayer) to be pressed if the user presses "1" on their keyboard, instead of using the mouse. How can I do that in FancyMenu ?

static lodgeBOT
#

I’m checking how FancyMenu handles keyboard navigation for menu buttons. I’ll see if there’s a built-in way to bind a key like 1 to a button, or if it needs a workaround 🙂

static lodgeBOT
# elder brook In the main menu of the game, I want the first button (Singleplayer) to be press...

Yep, you can do that in FancyMenu 😄

The basic idea is:

  1. Create a listener for keyboard input
  2. Check if the pressed key is 1
  3. Trigger a fake click on the Singleplayer button

What to do:

  • Open the menu bar
  • Go to CustomizationManage Listeners
  • Create a listener like On Keyboard Key Pressed
  • Add an IF condition that checks the pressed key, using the listener variable $$key_name
  • If it is 1, run the action Mimic Vanilla/Mod Button

For the button target, you need the title screen’s screen identifier and the button locator for Singleplayer. The easiest way is:

  • Open the Title Screen
  • Enable FancyMenu’s Debug Overlay
  • Use that info to get the screen identifier
  • Then set the mimic action to that title screen button

So in short:

  • Listener: keyboard key press
  • Condition: key is 1
  • Action: mimic the Singleplayer button on the title screen

If you want, I can help you build the exact listener script step by step and show you where to find the button ID in the debug overlay 🙂

elder brook
#

Wouldn't this happen if I was in a world (In-game)?

static lodgeBOT
#

Good catch, I’m double-checking whether that key listener also fires while you’re actually in a world, so I can tell you the safe setup 🙂

static lodgeBOT
# elder brook Wouldn't this happen if I was in a world (In-game)?

Yes, exactly 😅

That listener would also fire in-game unless you restrict it to the main menu.

So the safe setup is:

  • Listener: On Keyboard Key Pressed
  • Condition 1: current screen is the Title Screen
  • Condition 2: pressed key is 1
  • Action: mimic the Singleplayer button

In FancyMenu terms, the cleanest guard is to check the current screen identifier and only run it when it matches the title screen, so it won’t trigger while you’re inside a world.

So the result is:

  • on main menu + press 1 → opens Singleplayer
  • in a world + press 1 → does nothing

If you want, I can help you write the exact IF setup in FancyMenu step by step 🙂

elder brook
#

How can I do both conditions?

static lodgeBOT
#

I’m checking the cleanest way to combine the screen check and the 1 key check in FancyMenu, so I don’t give you the wrong setup 🙂

static lodgeBOT
# elder brook How can I do both conditions?

Use nested IFs 🙂 That’s the easiest way to combine both conditions in FancyMenu.

Do it like this:

IF screen is title_screen
  IF key name is 1
    Mimic Vanilla/Mod Button

In the listener:

  1. Create an On Keyboard Key Pressed listener
  2. Add an IF that checks the current screen is the Title Screen
    • usually by checking screenid
  3. Inside that IF, add another IF that checks $$key_name is 1
  4. Inside the second IF, add Mimic Vanilla/Mod Button for the Singleplayer button

So the logic is:

  • on title screen + press 1 → click Singleplayer
  • anywhere else + press 1 → nothing happens

If you want, I can also help you with the exact FancyMenu block layout, like which menu item to click first and what each IF should be set to 🙂

elder brook
#

There is no text, it's like choosing things

static lodgeBOT
#

I’m checking how the UI does multiple conditions, because it sounds like FancyMenu uses selectable requirements instead of typed script text 🙂

static lodgeBOT
# elder brook There is no text, it's like choosing things

Yep, that’s normal in FancyMenu 🙂 You’re not supposed to type a full script there, you just pick conditions from the UI.

Do it like this:

  1. Open the listener
  2. Add an IF
  3. In that IF, choose a screen check
    • either Is Screen Title
    • or a screen identifier check if that’s what your UI shows
  4. Inside that IF, add another IF
  5. In the second IF, choose the keyboard variable, usually $$key_name
  6. Set it to 1
  7. Put the Mimic Vanilla/Mod Button action inside the second IF

So the structure is basically:

  • IF: on title screen
    • IF: key pressed is 1
      • click Singleplayer

If your UI has a way to add multiple requirements in one IF, that would also work, but the safest way is to just nest two IFs.

If you want, I can help you identify exactly which dropdown option to pick for the screen check and the key check based on what you see in your menu screen 🙂

elder brook
#

Looks like it cant happen in fanccymenu, thanks for trying anyway

static lodgeBOT
#

Got it, I’m just checking whether there’s any documented FancyMenu workaround before I answer back 🙂

static lodgeBOT
# elder brook Looks like it cant happen in fanccymenu, thanks for trying anyway

Yep, fair enough 🙂 FancyMenu can listen for key presses, but there isn’t a clearly documented, reliable way to bind 1 to the vanilla Singleplayer button on the title screen.

So I’d treat this as not really supported in FancyMenu.

If you want, I can still help with another FancyMenu menu tweak or workaround idea 🙌

static lodgeBOT
#
Thread Marked as Solved

This support thread has been marked as solved by @elder brook.

The AI helper is now disabled.