Disabling the message visibility script with a switch

Hello, i use this script from efeberk and i want to be able to hide the window on ctrl, but I should not have this function in the entire game, but only at some points.. is it possible to add some kind of addition to the script so that i can configure switch to disable the script and enable it again? Thank you very much if someone can help me.
Spoiler: SCRIPT
Code:
=begin
===============================================================================
 Message Visibility by efeberk
 Version: RGSS3
===============================================================================
 This script will allow to player sets message window visible or unvisible with
 a key.
 
 Example : Press CTRL to hide message window and repress CTRL to show message
 window.
--------------------------------------------------------------------------------
=end


module EFE
 
  KEY = :CTRL


end


class Window_Message < Window_Base
 
  alias efeberk_window_message_update update
  def update
    efeberk_window_message_update
    if Input.trigger?(EFE::KEY)
      self.visible = !self.visible
    end
  end
 
end
I have moved this thread from RGSS3 Scripts (VXAce) as it’s not a script release, and moved it RGSSx Script Support.
I think you would do something like, where switch #1 if ON will enable the functionality and if OFF will do nothing.
Spoiler: Script
Code:
Code:
=begin
===============================================================================
 Message Visibility by efeberk
 Version: RGSS3
===============================================================================
 This script will allow to player sets message window visible or unvisible with
 a key.
 
 Example : Press CTRL to hide message window and repress CTRL to show message
 window.
--------------------------------------------------------------------------------
=end


module EFE
 
  KEY = :CTRL


end


class Window_Message < Window_Base
 
  alias efeberk_window_message_update update
  def update
    efeberk_window_message_update
    if $game_switches[1] == true && Input.trigger?(EFE::KEY)
      self.visible = !self.visible
    end
  end
 
end
Or you can just add a line to the visibility

Spoiler: with switch 1
Ruby:
=begin
===============================================================================
 Message Visibility by efeberk
 Version: RGSS3
===============================================================================
 This script will allow to player sets message window visible or unvisible with
 a key.
 
 Example : Press CTRL to hide message window and repress CTRL to show message
 window.
--------------------------------------------------------------------------------
=end

module EFE
 
  KEY = :CTRL

end

class Window_Message < Window_Base
 
  alias efeberk_window_message_update update
  def update
    efeberk_window_message_update
    if Input.trigger?(EFE::KEY)
      self.visible = !self.visible if $game_switches[1] == true
    end
  end
end
I have moved this thread from RGSS3 Scripts (VXAce) as it’s not a script release, and moved it RGSSx Script Support.
Oops, sorry. Due to the terrible translator, the difference between the RGSSx and RGSS3 forums was always unclear to me.
Or you can just add a line to the visibility

Spoiler: with switch 1
Ruby:
=begin
===============================================================================
 Message Visibility by efeberk
 Version: RGSS3
===============================================================================
 This script will allow to player sets message window visible or unvisible with
 a key.
 
 Example : Press CTRL to hide message window and repress CTRL to show message
 window.
--------------------------------------------------------------------------------
=end

module EFE
 
  KEY = :CTRL

end

class Window_Message < Window_Base
 
  alias efeberk_window_message_update update
  def update
    efeberk_window_message_update
    if Input.trigger?(EFE::KEY)
      self.visible = !self.visible if $game_switches[1] == true
    end
  end
end
Thank you, it works. The thread may be closed.
This thread is being closed due to being solved. If you need it reopened, report it to let us know why. Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/disabling-the-message-visibility-script-with-a-switch.163406/