Setting up priority in a custom item menu

I've set up a custom menu with pictures, and the menu itself functions perfectly but I'm struggling when it comes to showing the right item pictures. There are only three items that the player can have at one time and they're supposed to have a priority order (item A before item B, item B before item C).

The priority works fine in any other case, but I realized that the way I wrote my code means that if the player only has items B and C, the item with the higher priority will occupy both the first and second slots. I can't think of a way to fix this so if anyone can offer a solution I would appreciate it! I've attached the code.

Screenshot 2024-07-09 143400.png

Screenshot 2024-07-09 143441.png

Screenshot 2024-07-09 143501.png

Screenshot 2024-07-09 143518.png

Screenshot 2024-07-09 143539.png

Screenshot 2024-07-09 143600.png


The section of code in question that is giving me issues is the Conditional Branch for "variable [cursor position] == 2", otherwise the priority order for positions 1 and 3 are perfectly fine. If more info is needed, I'd be happy to explain.
the problem is you have a condition == x and add + 1, than check again.

it's cleaner to separate those, if right is press + 1
if number variable > 5, return 0 and if < 0, return 6.

depending when you press the right or left key.

I made a tutorial for MV version, but similar apply to any version, but slight different.
as it is a main menu, it works on any version probably.

I don't know about the key stroke part why it is used
or how your menu looks like.
I believe that each property item should have a switch, to turn it off and on, so you can have control over its use in the menu.
For example, if item A is shown, items B and C are turned off, if item B is shown, items A and C are turned off.
This way you can display the image of the item, in the respective "slot", now the way of purchasing the item has to be taken into account in the system. For example, the player has an item A and not B and C, the conditions and variables must recognize this situation as an "empty slot"
the problem is you have a condition == x and add + 1, than check again.

it's cleaner to separate those, if right is press + 1
if number variable > 5, return 0 and if < 0, return 6.

depending when you press the right or left key.

I made a tutorial for MV version, but similar apply to any version, but slight different.
as it is a main menu, it works on any version probably.

I don't know about the key stroke part why it is used
or how your menu looks like.
Sorry, which condition are you referring to that's the problem? I could be misunderstanding what you mean but if you're referring to the code about pressing the keys to scroll through the menu, that is how it's been set up.

If < 0 instead of returning a specific number it returns the maximum amount of items that the player has, because that can change. The menu keystroke variable is to keep track of which key was actually pressed (confirm/cancel/directional keys).

The issue that I'm having isn't about the scrolling, it's that I'm trying to figure out how to make it so that item B (the lighter) doesn't take up the second slot if it is already in the first slot.

I believe that each property item should have a switch, to turn it off and on, so you can have control over its use in the menu.
For example, if item A is shown, items B and C are turned off, if item B is shown, items A and C are turned off.
This way you can display the image of the item, in the respective "slot", now the way of purchasing the item has to be taken into account in the system. For example, the player has an item A and not B and C, the conditions and variables must recognize this situation as an "empty slot"
This worked perfectly, thank you so much! I didn't want to have assigned slots because the player can only have two items for most of the game and they get reset every in-game day, but I tried setting up the conditions in the way you described and used a switch for item B instead of having it dependent on item B being in the inventory and I got the desired result.

1720561337337.png


Thank you both for your input!

Original thread: https://forums.rpgmakerweb.com/threads/setting-up-priority-in-a-custom-item-menu.170155/