Temporarily Disable X/Cancel/Right-Click?

So I'm trying to create an event where the game opens the main command menu for the player and selects the "Skill Trees" option, or perhaps directly open the Skill Tree scene (@SomeFire's plug) but that's not the biggest issue I have. I need to make sure the player can't exit out of that screen until they spend their 1st JP (which they start w/). Is this even possible?

Edit: On second thought, this might fall under JS/plugin support... Then again, the disabling of X/Cancel/Right-Click as a feature could be used for other purposes as well, not just this use case.
I just made this real quick and can't confirm that it works for sure, but give it a shot and see what happens.

When the plugin is enabled, the cancel button should do nothing only in the skilltrees window, but only if switch 51 is turned ON. You can change the switch number by editing the js file.

You'll need to find a way to turn that switch back off again once the SP is spent, as I'm not entirely sure how to do that, but this is a good start, I'd say.

Edit: probably edit the if check to check both for the switch, and for having Sp above 0. I'm not sure on the exact function to call to check for it, but that should be easy enough to figure out.
Thank you, I actually have the rest figured out. This was the only missing piece.😂
Sorry, I already know it doesn't work, because I forgot to call my alias. XD
I made it in a hurry right before work was over, so, my bad. Try this one instead.

Original thread: https://forums.rpgmakerweb.com/threads/temporarily-disable-x-cancel-right-click.129690/