use item trigger common event not make the menu closed

I would like to make an item to call a common event when using it
but the menu will not close after used (just like using normal item)
is it possible to achieve this?
The problem is that the common event requires an interpreter to run, and the interpreter only works on the map, not in the menu.

so you can only re-open the menu with a script call or you need a plugin to create an interpreter on the menu.
Depending on the effects of your item/common event, maybe you can achieve the results by utilizing the damage formula... Otherwise, you need to follow Andar's suggestions.
The script call
SceneManager._scene.popScene()
Will remove the current scene. If you're in the menu, that will back out of it to the previous screen you were on when the menu opened.
Below is code I tested to shut the menu down by a switch.

spAliasSceneMenuUpdate = Scene_Menu.prototype.update
Scene_Menu.prototype.update = function(){
spAliasSceneMenuUpdate.call(this);
if($gameSwitches.value(x)) SceneManager._scene.popScene()
}

This worked in a regular test for me. If you save that in a plugin, basically it will close the menu when a certain (x) is turned on. I don't know if this helps, or what your exact setup is. Either way, with the above code, once switch x (10, for example )is on, it leaves the Menu Scene. So if the menu is open, it will pop that scene and go back to whatever was the scene before it opened.

You'd want to shut the switch off after, so the menu can open normally again

I hope this is useful somehow.
I see
thanks for all replies!

The script call
SceneManager._scene.popScene()
Will remove the current scene. If you're in the menu, that will back out of it to the previous screen you were on when the menu opened.
Below is code I tested to shut the menu down by a switch.

spAliasSceneMenuUpdate = Scene_Menu.prototype.update
Scene_Menu.prototype.update = function(){
spAliasSceneMenuUpdate.call(this);
if($gameSwitches.value(x)) SceneManager._scene.popScene()
}

This worked in a regular test for me. If you save that in a plugin, basically it will close the menu when a certain (x) is turned on. I don't know if this helps, or what your exact setup is. Either way, with the above code, once switch x (10, for example )is on, it leaves the Menu Scene. So if the menu is open, it will pop that scene and go back to whatever was the scene before it opened.

You'd want to shut the switch off after, so the menu can open normally again

I hope this is useful somehow.

thanks for testing it for me
forgive me if I misunderstood the method
what I want to do is keep the menu opened but not close it
do you have other treatment for this?
so what if...
instead of calling a common event, is there a method to turn a switch on?
then I can set another event which trigger by this switch
spAliasSceneMenuPopScene= Scene_Menu.prototype.popScene;
Scene_Menu.prototype.popScene = function(){
if($gameSwitches.value(id) == false) spAliasSceneMenuPopScene.call(this)
}

This does the opposite. It will only allow the menu to shut if Switch with id in parenthesis is off. Is this what you're talking about?
Is this what you're talking about?
you're missing the point.
The unwanted closing of the menu is only the side-effect, not the cause.
The cause is that the common event can only be processed on the map itself, because the game interpreter by default only exists on the map.
So the item needs to close the menu for the common event to be processed.

The OP doesn't want this closing, but he still wants the common event to run.
And as I said above that can only be solved by either adding a game-interpreter-code to the menu scenes, or by re-opening the menu after the common event is run.

@arashiya
it is possible to set a switch in the damage formula of the item, just check the pinned topic for the damage formula coding to learn of the command syntax. If you make the common event an autorun triggered by that switch it will be processed as soon as the player leaves the menu (don't forget to turn off the switch at the end)

Or you could try to use Tsukihime's plugin for scene interpreters, that is the alternative I mentioned.
I can finally make sth similar to what I want
thanks so much for all the supports!
Thread closed IgnoreMe

Original thread: https://forums.rpgmakerweb.com/threads/use-item-trigger-common-event-not-make-the-menu-closed.114761/