Bestiary switch?

I found a Bestiary script by Modern Algebra. I was wondering if anybody knew how to make it so the Bestiary is unlockable? Pretty much just like. Making it so from the start of the game, the menu option appears as "???" but after a switch is turned on, the menu option becomes "Bestiary" and works like it normally would. Thanks!

87313427_P3KFYoiRSLC2TfK.png


The Script
Ruby:
MAMC_CONFIG.merge!({
  :menu_hidden => "???",
  :menu_switch => 11
})

class Window_MenuCommand
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Insert Command
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def maic_insert_command(symbol)
    command = MA_COMMAND_INSERTS[symbol]
    # Get the command name
    name = command.name.is_a?(Symbol) ? eval(command.name.to_s) : command.name
    # Check whether enabled
    enabled = case command.enable
    when Integer then command.enable == 0 ? true : $game_switches[command.enable]
    when String then eval(command.enable)
    when Symbol then self.send(command.enable)
    else
      enabled = true
    end
    # Add the command to the list
    if $game_switches[MAMC_CONFIG[:menu_switch]] == false
      add_command(MAMC_CONFIG[:menu_hidden], nil, false)
    else
      add_command(name, symbol, enabled)
    end
    added = @list.pop
    @list.insert([command.index, @list.size].min, added) # Insert at specific index
  end
end

class Scene_Menu
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set Inserted Handler
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def maic_set_insert_handler(symbol)
    other = MA_COMMAND_INSERTS[symbol].other
    handler = case other
    when Symbol then method(other)
    when String then lambda { eval(other) }
    when TrueClass then method(:command_personal)
    else
      if $game_switches[MAMC_CONFIG[:menu_switch]] == false
        handler = nil
        symbol = nil
      else
        handler = method(:maic_command_insert)
      end
    end
    @command_window.set_handler(symbol, handler)
  end
end
Ruby:
MAMC_CONFIG.merge!({
  :menu_hidden => "???",
  :menu_switch => 11
})

class Window_MenuCommand
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Insert Command
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def maic_insert_command(symbol)
    command = MA_COMMAND_INSERTS[symbol]
    # Get the command name
    name = command.name.is_a?(Symbol) ? eval(command.name.to_s) : command.name
    # Check whether enabled
    enabled = case command.enable
    when Integer then command.enable == 0 ? true : $game_switches[command.enable]
    when String then eval(command.enable)
    when Symbol then self.send(command.enable)
    else
      enabled = true
    end
    # Add the command to the list
    if $game_switches[MAMC_CONFIG[:menu_switch]] == false
      add_command(MAMC_CONFIG[:menu_hidden], nil, false)
    else
      add_command(name, symbol, enabled)
    end
    added = @list.pop
    @list.insert([command.index, @list.size].min, added) # Insert at specific index
  end
end

class Scene_Menu
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set Inserted Handler
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def maic_set_insert_handler(symbol)
    other = MA_COMMAND_INSERTS[symbol].other
    handler = case other
    when Symbol then method(other)
    when String then lambda { eval(other) }
    when TrueClass then method(:command_personal)
    else
      if $game_switches[MAMC_CONFIG[:menu_switch]] == false
        handler = nil
        symbol = nil
      else
        handler = method(:maic_command_insert)
      end
    end
    @command_window.set_handler(symbol, handler)
  end
end

Thank you! This nearly 100% works, the only issue is that the game doesn't label the Bestiary as "???" prior to the switch unlocking the Bestiary.



Also, if the "???" could look similar to how the Formation button does when unavailable that'd help a ton too ^_^
Also, if the "???" could look similar to how the Formation button does when unavailable that'd help a ton too ^_^
You have something else that is causing that.
1724193117470.png
You have something else that is causing that.
View attachment 315289

Oh, huh. It might be one of my other scripts I'll try to figure out the issue going on.
Oh, huh. It might be one of my other scripts I'll try to figure out the issue going on.

NEVERMIND! i was doing something wrong with your script, everythings all solved.

Original thread: https://forums.rpgmakerweb.com/threads/bestiary-switch.171238/