Game Switch turns off when Message or Menu is displayed

Hello! I have scoured the internet for something like what I am looking for. I evented a time system that runs on one Switch, (switch 1,) and when it is turned off, time stops momentarily.

I would, however, like time to stop automatically when either the default menu or conversational messages appear on the screen.
 
I COULD do this by eventing, by putting a control switch operation before and after each NPC message, but  I could not do it for the menu, I think. I think that it would be more convenient to have one plugin do it all for the sake of my sanity.
 
I tried to Frankenstein my own plugin for what I needed by using Hudell's OrangeTimeSystem script because there is an option in it to pause time by checking if the gameMessage is "Busy." I attempted to figure out how it was done and replicate it, but to no avail.

$.isInternallyPaused = function() {
    if ($.Param.pauseClockDuringConversations === true) {
      if (SceneManager._scene instanceof Scene_Map) {
        if ($gameMessage.isBusy()) {
          return true;

        }
      }
    }

    return false;
  };

I know that if I could just figure out how to do this, I would be set. But after hours of trying to do it without any real experience with JS, I just threw my hands up.

So basically, I am asking for a plugin that checks to see  if the menu or a message window is showing, if it is, turn switch 1 OFF. If it is not (else,) to turn the switch ON.

I hope that this isn't complicated, I don't think it should be??

Please let me know if you can help! Thanks!
Programming doesn't work that way - you'll need to turn on the switch when the command to open a scene is processed, and turn it off when the command to exit the last scene is processed and the player returns to the map. That is because in the engine, there is no parallel check for wether you're in a menu or not.

Parallel Processes in events are only looking simple from the eventing side, replicating them in the engine's game loop by scripting is not easy, that's why you have to enter the commands in the places described above.

I also suggest that you change the used switch - ID#1 is a default for a lot of settings, and if you forget to change that and have it used somewhere, you'll have one hell of a bughunt (for example if turning a common event to parallel process or autorun, the default switch is #1)
Oh, I see, that makes sense. I can easily change the Time Switch to something else. I could also use a conditional branch in the time common event to check if the Switch is Off instead of On, instead, to make time run. Would that make things easier?

Thanks for answering~!

Original thread: https://forums.rpgmakerweb.com/threads/game-switch-turns-off-when-message-or-menu-is-displayed.54095/