(solved) please review my custom menu and tell me what i'm doing wrong

okay to keep this short, my custom menu keeps skipping to the options button (the 8th image and number 7 in the variable) when i go right and i don't know what the problem is since going left works just fine

please tell me why it won't work properly (it's probably obvious but this is my first time trying to replace the pause menu or whatever its called)

◆If:Button (left) is pressed down
◆Wait:10 frames
◆If:menu selector = 2
◆Move Picture:#2, Center (55,30), (60%,60%), 255, Normal, 10 frames
◆Move Picture:#3, Center (160,-300), (60%,60%), 255, Normal, 10 frames
◆Control Variables:#0055 menu selector = 1
◆
:End
◆If:menu selector = 3
◆Move Picture:#3, Center (160,30), (60%,60%), 255, Normal, 10 frames
◆Move Picture:#4, Center (265,-300), (60%,60%), 255, Normal, 10 frames
◆Control Variables:#0055 menu selector = 2
◆
:End
◆If:menu selector = 4
◆Move Picture:#5, Center (370,-300), (60%,60%), 255, Normal, 10 frames
◆Move Picture:#4, Center (265,30), (60%,60%), 255, Normal, 10 frames
◆Control Variables:#0055 menu selector = 3
◆
:End
◆If:menu selector = 5
◆Move Picture:#5, Center (370,30), (60%,60%), 255, Normal, 10 frames
◆Move Picture:#6, Center (475,-300), (60%,60%), 255, Normal, 10 frames
◆Control Variables:#0055 menu selector = 4
◆
:End
◆If:menu selector = 6
◆Move Picture:#6, Center (475,30), (60%,60%), 255, Normal, 10 frames
◆Move Picture:#7, Center (580,-300), (60%,60%), 255, Normal, 10 frames
◆Control Variables:#0055 menu selector = 5
◆
:End
◆If:menu selector = 7
◆Move Picture:#7, Center (580,30), (60%,60%), 255, Normal, 10 frames
◆Move Picture:#8, Center (685,-300), (60%,60%), 255, Normal, 10 frames
◆Control Variables:#0055 menu selector = 6
◆
:End
◆
:End
◆If:Button (right) is pressed down
◆Wait:10 frames
◆If:menu selector = 1
◆Move Picture:#2, Center (55,-300), (60%,60%), 255, Normal, 10 frames
◆Move Picture:#3, Center (160,30), (60%,60%), 255, Normal, 10 frames
◆Control Variables:#0055 menu selector = 2
◆
:End
◆If:menu selector = 2
◆Move Picture:#3, Center (160,-300), (60%,60%), 255, Normal, 10 frames
◆Move Picture:#4, Center (265,30), (60%,60%), 255, Normal, 10 frames
◆Control Variables:#0055 menu selector = 3
◆
:End
◆If:menu selector = 3
◆Move Picture:#5, Center (370,30), (60%,60%), 255, Normal, 10 frames
◆Move Picture:#4, Center (265,-300), (60%,60%), 255, Normal, 10 frames
◆Control Variables:#0055 menu selector = 4
◆
:End
◆If:menu selector = 4
◆Move Picture:#5, Center (370,-300), (60%,60%), 255, Normal, 10 frames
◆Move Picture:#6, Center (475,30), (60%,60%), 255, Normal, 10 frames
◆Control Variables:#0055 menu selector = 5
◆
:End
◆If:menu selector = 5
◆Move Picture:#6, Center (475,-300), (60%,60%), 255, Normal, 10 frames
◆Move Picture:#7, Center (580,30), (60%,60%), 255, Normal, 10 frames
◆Control Variables:#0055 menu selector = 6
◆
:End
◆If:menu selector = 6
◆Move Picture:#7, Center (580,-300), (60%,60%), 255, Normal, 10 frames
◆Move Picture:#8, Center (685,30), (60%,60%), 255, Normal, 10 frames
◆Control Variables:#0055 menu selector = 7
◆
:End
◆
:End​
​

​


oh i think the brackets messed up the text (i fixed it now)
Well, didn't understood what is happening there (Bug related). But I can help, making a suggestion, so your code become more clean, and probably fix your issue, I think...
Instead, making a condition checking the menu selectected, and later define the variable "=" the menu.
You can instead make a conditional increment "+=" or subtract "-=" if you press the left or right button.
And only later check the variable to display an image if equals to the selected menu.

If I not mistaken, your logic here is if left pressed and menu equals 2 then show image and change menu to 1.

The logic I'm saying is if left is pressed, subtract 1, and check if selected menu is 2, so show image if it's equal to 2.

Making your code like that reduce the length, probably, and remove the chance to have had a mistaken declaring the selected menu wrong.

If you're still in doubt, I can provide a image later.
Follow the logic through. Let's say you're at position 1 and you press right:
  • Right button is pressed? Yes.
  • Variable = 1? Yes, so set the variable to 2 and update the picture.
  • Variable = 2? Yes, so set the variable to 3 and update the picture.
  • Etc.
You could change how the checks are processed in the "is right button pressed" branch:
  1. Reverse the order, i.e. change from 1, 2, 3, etc -> 7, 6, 5, etc; or
  2. Nest the checks in Else branches, i.e. "if variable = 1, else: if variable = 2, else: etc.
I recommend option 2, because then you can be certain it will only ever do one of the branches.

As Skagamine says, you could also make the event neater by separating the "change selected index" and "update picture" processes. That shouldn't affect the actual result, though.
Nest the checks in Else branches, i.e. "if variable = 1, else: if variable = 2, else: etc.
this was the solution, thanks!
This thread is being closed due to being reported as solved. If you need it reopened, let us know. Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/solved-please-review-my-custom-menu-and-tell-me-what-im-doing-wrong.167818/