Tweak to Menu While Message Script (SOLVED)

Hey, guys.

I could really use some help here with this one script I'm using for my game. I'm using regendo's menu while message script for my game, which you can see at the bottom of this post. Essentially it lets you call the menu while a message is on screen, which is great for visual novel segments and such. There's only one problem I have with it.

Long story short, I use common events for certain animations, but I don't want the user to be able to open the menu while those animations are playing, as it can throw off the sync between sound and visual. I see down there in the script that there's a configuration setting for scenes where you don't want the menu to be callable, but I'm pretty sure that's not the same thing as what I'm looking for.

If any of you would be willing, I would really appreciate it if you could modify this script to disallow the menu call based on a variable's value or something like that (preferably a variable over a switch, though). I don't think that sounds too complicated to work in there, but I don't know anything about scripting, so I could be dead wrong.

Thanks for any help you guys are able to give me!

Code:
#===================================
# MenuScreen While Message (MSWM)
#===================================
# by bStefan aka. regendo
# by request from AABattery
# : http://www.rpgmakervxace.net/index.php?/user/608-aabattery/
# please give credit if used
# for use with RMVX ACE
#===================================
# Call Scene_Menu while a message
# : is being displayed
#===================================
# implement over Main
#===================================
# customize:
# : add Scenes you don't want the
# : script to happen to NOCALLMENU
# : (like Scene_Battle, which would
# : be really annoying)
#===================================

module Regendo
 
  unless @scripts
    @scripts = Hash.new
    def self.contains?(key)
      @scripts[key] == true
    end
  end
  @scripts["Menu_during_Message"] = true
 
  module Menu_during_Message
    
    #=======
    #CONFIG
    #=======
    NOCALLMENU = [Scene_Battle] #scenes in which call_menu shall not work.
    BUTTON = Input::B #which button will trigger the menu?
  end
end
 
class Window_Message < Window_Base

  BUTTON = Regendo::Menu_during_Message::BUTTON
  NOCALLMENU = Regendo::Menu_during_Message::NOCALLMENU
 
  alias update_old update
  def update
    update_old
    call_menu if Input.trigger?(BUTTON) && !forbidden_scene_by_regendo
  end
 
  def call_menu
    Sound.play_ok
    SceneManager.call(Scene_Menu)
    Window_MenuCommand::init_command_position
  end
 
  def input_pause
    self.pause = true
    wait(10)
    
    case BUTTON
    when Input::B
      Fiber.yield until Input.trigger?(:C)
    when Input::C
      Fiber.yield until Input.trigger?(:B)
    else
      Fiber.yield until Input.trigger?(:B) || Input.trigger?(:C)
    end
    
    Input.update
    self.pause = false
  end
 
  def forbidden_scene_by_regendo
    return false unless NOCALLMENU
    NOCALLMENU.any? do |scene|
      SceneManager.scene_is?(scene)
    end
  end
end
It's preferable to provide links to scripts rather than posting them in your thread, for a number of reasons that I won't go into unless you're really curious.

On page 3 of the event commands, there is a Change Menu Access command. Try setting that before and after the animations and see if it makes a difference. If it doesn't (and I suspect it won't), change this line:

Code:
call_menu if Input.trigger?(BUTTON) && !forbidden_scene_by_regendo

to this:

Code:
call_menu if Input.trigger?(BUTTON) && !forbidden_scene_by_regendo && !$game_system.menu_disabled

This will allow you to use that command when you want to enable/disable menu access, and the script will pay attention to it.

If you REALLY want to use a variable instead (you're still going to have to change the value before/after every animation), give more detail about how the variable would work.
Ah, sorry about that. Was actually a little iffy on if it was okay for me to just copy/paste the script like that, but went the lazy route and did it anyways. I'll keep that in mind for the future.

But yeah, that's perfect! Thanks a lot! I guess it was even easier than I thought by the looks of it. :eswt: But I had everything set up for all of the animations using the menu disable command before, so I just plugged it in and everything seems to be working fine now! Easier fix than I was hoping for! Thanks again!

Original thread: https://forums.rpgmakerweb.com/threads/tweak-to-menu-while-message-script-solved.90826/