Need help fixing my custom menu

Hiya! I've been working on a custom menu screen recently and I've run into a little problem. I'm running several events to create interactable buttons ("Load Game", "New Game", and "Quit"), and when they are interacted with they work fine (e.g. "Quit" actually quits the game and so on). However, there is something going wrong with the navigation. It just doesn't really respond to the up and down inputs and I'm pretty sure it has something to do with the variables.

Here's the code for navigation & input:

1716917835756.png
1716917864231.png


The Common Event UpdateMenuGraphics is there to give the buttons a highlighted look when selected and works, as far as I can tell, without trouble.
1716917985247.png


This issue probably has a really easy solution but I just can't spot what error I've made so any help is greatly appreciated <3
I'm pretty sure your logic is wrong. From the UpdateMenuGraphics, it looks like you're supposed to have 3 menu items.

But in the menu loop, you say "if you went up and you're at 1, go to 3" - but how could that ever be true? It doesn't look like there's any way for MenuSelection to be 0.

Similarly, you say "if you went down and you're at 3, go to 1" but it doesn't appear for there to be any way MenuSelection could have been 4.

So the numbers are wrong and the directions appear to be backwards. If going down subtracts from the value, then you want to see if it went to 0, and if yes bump it back to 3. And going up adds to the number, so if that goes to 4 you reset it to 1.
Also, add a "Wait: 1 frame" command, just before "Repeat Above". The inputs only need to be checked once per frame.

You might consider using isRepeated for the up/down checks, instead of isTriggered. That's just a style choice, though.

If you still have trouble, you could try adding a command like this inside the button press branches:
  • Show Text: MenuSelection = \v[6].
That can help identify whether the inputs are being registered, and if so whether the variable is updating to the correct values.
I'm pretty sure your logic is wrong. From the UpdateMenuGraphics, it looks like you're supposed to have 3 menu items.

But in the menu loop, you say "if you went up and you're at 1, go to 3" - but how could that ever be true? It doesn't look like there's any way for MenuSelection to be 0.

Similarly, you say "if you went down and you're at 3, go to 1" but it doesn't appear for there to be any way MenuSelection could have been 4.

So the numbers are wrong and the directions appear to be backwards. If going down subtracts from the value, then you want to see if it went to 0, and if yes bump it back to 3. And going up adds to the number, so if that goes to 4 you reset it to 1.
aah yeah that makes sense, I fixed it by setting the default value to 0 and the variable checks to 0 and 4. Thank you so much for your help! <3

Also, add a "Wait: 1 frame" command, just before "Repeat Above". The inputs only need to be checked once per frame.

You might consider using isRepeated for the up/down checks, instead of isTriggered. That's just a style choice, though.

If you still have trouble, you could try adding a command like this inside the button press branches:
  • Show Text: MenuSelection = \v[6].
That can help identify whether the inputs are being registered, and if so whether the variable is updating to the correct values.
tysm! that "wait 1 frame" actually helped out a bunch to get rid of the weird lag-ish feel! <3
I made an evented menu, and there are 3 others in a different style, so you
can also check those and compare.

I dont know why you have selection of 2, 1, 3 and not 1, 2, 3 in the order.
down is mostly +1 while up = -1, but that depends on the layout of the menu as well.

so there are setup choices and if you work with images or not, so you can learn
a lot from other eventing tutorials and improve your own to make it work nicely.

Original thread: https://forums.rpgmakerweb.com/threads/need-help-fixing-my-custom-menu.169069/