MZ How to add a scene cancel event to a custom menu entry?

I'm using the Visustella main menu core to add a menu entry for a lore book page (using Taaspider's lore book menu plugin at https://taaspider.itch.io/taa-bookmenu). I've gotten mostly everything to work out the way I need to, but I have one little issue left. When you access most menu scenes (equip, items, whatever), cancelling that scene takes you to the main menu, rather than backing out of all menus and bringing the player back to the map. The way I have my menu configured, I can't figure out how to do that with this lore book page.

During a previous attempt, I was using the Visustella common event menu plugin (http://www.yanfly.moe/wiki/Common_Event_Menu_VisuStella_MZ), which has a feature for a "cancel event." This let me reopen the main menu again when cancelling the custom common event menu. Is there any good way to add a similar cancellation event to one of the main menu entries from within the plugin itself, maybe by adding some JavaScript? Otherwise my plan is to try I using an event loop within the common event below like this page suggests (tutorial for an event-based picture menu), but it would be nicer just to call the menu back with a common event or something like that. Here's how I have my event configured in the VisuStella plugin. It just calls on a common event which opens the Taaspider scene. Any help would be appreciated!


1730657790634.png


Here's the common event. Basically just a quick script command I got from Taaspider's instructions.

1730657835653.png
Why are you making it into a common event instead of simply putting the push() call into the code for the VisuStella plugin?

That should automatically fix your problem, I'd think - by making it a common event, you're forcing the engine to close the menu in order to execute the common event. There's no longer a scene in the stack beneath the book menu to cancel back to (more specifically, the scene in the stack beneath will be the map).
Haha, mostly just because I didn't know how to do that to begin with. Still trying to grasp the difference between scenes and events in a programming sense. Events fit inside of scenes, but I didn't realize that scenes stack in that way. Guess it makes since, because you can go in and out of menus or battles and return to the map. Using the command SceneManager.push(Scene_BookMenu) works just fine. Thanks again for your input!
Still trying to grasp the difference between scenes and events in a programming sense.
I'm not super sure what you mean...if you can think of a more specific thing to ask, I'll try to help. There's really no similarity between the two.

Events fit inside of scenes
I mean...I guess? A scene primarily has to do with the game's interface. The scene contains all of the windows that display everything you see and controls how they work with each other.

Events contain lists of commands that you place inside of them. They're executed by a process called an interpreter which goes down the list of commands and translates the event command into game code and does the thing.

So events and scenes don't do anything similar to each other - the only way they're related is that only certain scenes have an interpreter to run events - the map and battle. And they each have their own interpreters: battles can only run troop events and any common events that are explicitly called. They can't run parallel, autorun, or map events.
Good to know. While messing with menus, I've found a few methods and plugins that use common events for menu items (some eventing-only approaches just string lots of common events together, and some plugins like Visustella common events menu plugin call a scene through a plugin command inside a common event [link, though I'm sure you're familiar]), so I had assumed that scenes were in essence complicated and JS-driven common events.

At this point, I think the only question that I have is how a new scene is usually created. Could I, for instance, event a menu section or a minigame of some kind, contain it in a common event, and use SceneManager.push(Scene_x) to call it? Or is it best practice to write a plugin? I don't have any other plans for additional scenes I'd like to add right now (tbh, I really hate minigames) but it seems like creating a new scene is probably beyond the scope of what I can do in JS right now.
While messing with menus, I've found a few methods and plugins that use common events for menu items (some eventing-only approaches just string lots of common events together
Right, that's an alternate way to create menus that display pictures or choices via event commands - that's not how the actual engine works and makes menus.

The engine has, as I described above, different scenes that contain a selection of windows which have information drawn inside of them.

I had assumed that scenes were in essence complicated and JS-driven common events.
Nope.

Could I, for instance, event a menu section or a minigame of some kind, contain it in a common event, and use SceneManager.push(Scene_x) to call it?
Absolutely not. Scenes and Windows are JavaScript data types. You can't set all that up in an event during runtime (maybe you could technically hack your way through some of it, but I'm not convinced it would work correctly and there's zero reason to do so).

it seems like creating a new scene is probably beyond the scope of what I can do in JS right now.
I would say it's moderately complex. The scene actually isn't the very difficult part, you should be able to copy and paste from another scene pretty easily if you know JavaScript well enough to understand what you're reading.

The windows and displaying information in them is the more complicated part, especially if you want to get into any non-text graphics.
As always, thanks for the explanations. I really appreciate the time you put into these replies to us hapless noobs.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-add-a-scene-cancel-event-to-a-custom-menu-entry.173011/