MV A way to disable certain menu elements on certain conditions without disabling the entire menu?

Good day!

In my game there is one certain area where I want to disable Item, Equip and some other menus but still let player have access to the rest (like Options, Save/Load, Quest Journal, etc). The best would be to hide them, but just disabling them would also be fine.

I found this code (can't remember already, where exactly):
def item if $game_switches[51] == true $game_system.se_play($data_system.decision_se) $scene = Scene_Item.new else $game_system.se_play($data_system.cancel_se)
It prevents from using items if switch is on, but I still can access the menu. Maybe there is a way to modify it somehow?
Since you don't mind hiding them there's a pretty simple way, although i'm not sure what this "Quest Journal" that you mentioned is, a plugin by chance?
Either way, if it's only the base menu commands you can do so by using this.
$dataSystem.menuCommands

With this command you have access to:
"item", "skill", "equip", "status", "formation", "save"

Example on how to use it:
In a script call you can type, in order to hide the "item" tab.
$dataSystem.menuCommands[0] = false

If you want to re-enable it you can type this instead:
$dataSystem.menuCommands[0] = true

The only thing you would change at most is the number "0" corresponding to the index of the command, which you can check just above the example i posted, the starting index being 0, of course.

One last detailed is that the code you posted is not javascript, i assume it's Ruby?
Hope this helped you!
Since you don't mind hiding them there's a pretty simple way, although i'm not sure what this "Quest Journal" that you mentioned is, a plugin by chance?
Either way, if it's only the base menu commands you can do so by using this.
$dataSystem.menuCommands

With this command you have access to:
"item", "skill", "equip", "status", "formation", "save"
Thank you! It worked!
And yes, Quest Journal is added by Yanfly's plugin.

It's a bit sad that I only can hide default menus (I actually wanted to hide menu added by Stat Allocation plugin as well), but it's not that big of a deal.
My main concern was that character could eat, drink and use equipment while being in a dream world 😀 This won't happen now thanks to you.

And the code... yeah, probably. It was for... RPG Maker XP, if I recall correctly.
It's a bit sad that I only can hide default menus (I actually wanted to hide menu added by Stat Allocation plugin as well)
All of Yanfly's plugins that show on the menu have Plugin Commands to disable and enable them. Just check the documentation.
All of Yanfly's plugins that show on the menu have Plugin Commands to disable and enable them. Just check the documentation.
Thanks for the tip. I guess I've skipped that part.

Original thread: https://forums.rpgmakerweb.com/threads/a-way-to-disable-certain-menu-elements-on-certain-conditions-without-disabling-the-entire-menu.156172/