How to check if scene_menu is true

So... Im using some mouse controls which locks mouse movement in game, what I want to do is when the players opens the menu
the mouse unlocks. What I've done so far is

1597879502495.png



Game is working but when I open the menu, the game still gives off else command, as if menu wasn't active and doesn't unlock the mouse.
When is your code running?

Edit: you may want to try doing something like this instead (untested):
JavaScript:
(function(alias) {
  Scene_Base.prototype.initialize = function() {
    alias.apply(this, arguments);
    pointerLock(true);
  };
})(Scene_Base.prototype.initialize);

(function(alias) {
  Scene_MenuBase.prototype.initialize = function() {
    alias.apply(this, arguments);
    pointerLock(false);
  };
})(Scene_MenuBase.prototype.initialize);
The code is running all the time, seems like your code is working, much thanks!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-check-if-scene_menu-is-true.125459/