little Bonus room script error (solved)

I'm using this script for a bonus room command option on my game,paired with a moghunter menu script.

1720033462810.png

1720033481384.png


It does work as intended,thats not rlly the issue. But when I tested a fake ending thing to learn how to make evented credits,I wanted to also test the bonus room in the title. so I did that and everything normal,except when i exited to the menu again,then i could no longer go back in,as if the script call had gone back to false or smth.
i tested while also having a save file with the script call on true,but the same happens. any time i exit in any way it goes back to not letting me go into the command.

here i had the 4 save files from different attempts at making it work somehow but still,wouldnt let me after i exited thru the menu to title screen.
1720035196417.png

i also tested it on a blank proyect so no,its not an incompatibility issue 🙁

edit: forgot to say,this new game its pointing at its the bonus room,i just havent made the graphic yet and re-used the new game one-
You probably need to use a global save data script.
And make sure $game_plus is a part of it.

I did this with Adittuzkimo's custom data script.
Also a small change to the bonus room script

Spoiler: Adiktuzmiko Custom Data
Ruby:
=begin
 Game Custom Data v1.26
 by AdiktuzMiko
 --- Date Created: 11/25/2013
 --- Last Date Updated: 07/18/2015
 --- Level: Easy
 
 This is a simple script which provides you with the capability of having custom data
 for your game that is saved outside of the save files. Since it is outside of save
 files, it is shared by all. You can even make multiple games share a single custom
 data file.
 
 You can utilize this for having persistent data between your game/games.
 
 You can specify where to put the custom data file, what name will it have and even
 what file extension.
 
==============================================================================
   ++ Installation ++
==============================================================================
 Install this script in the Materials section in your project's
 script editor.
 
 Modify the ADIK::DATA module to your liking
 
==============================================================================
   ++ Script Calls ++
==============================================================================
 
 CustomData.get(key) to get a certain value
 CustomData.set(key,value) to set the value saved in "key" equal to "value"
 CustomData.add(key,value) to add value to the current value of the data
 CustomData.sub(key,value) to subtract value to the current value of the data
 CustomData.mul(key,value) to multiply the current value of the data by the given value
 CustomData.div(key,value) to divide the current value of the data by the given value
 CustomData.push(key,value) to add the given value into an array saved as custom data
 CustomData.delete(key,value) to remove the given value from an array saved as custom data
 CustomData.save to save the current contents of custom data
 
 Note: Custom Data is loaded automatically upon running the game
 
==============================================================================
   ++ Compatibility ++
==============================================================================
 This script aliases the following default VXA methods:

   DataManager#load_database
     DataManager#load_game
     Scene_Title#start
     DataManager#save_game_without_rescue
==============================================================================
   ++ Terms and Conditions ++
==============================================================================

 Read this: http://lescripts.wordpress.com/terms-and-conditions/

==============================================================================

 
=end

module ADIK
  module DATA
 
  # Primary folder where the save data will be placed
  # based on the default paths in your computer
  # set to nil if you don't want to use this
  DATA_PATH = 'AppData'
    
#~     Heres a list of parameters you can set the DATA_PATH into
#~     
#~     AppData = Contains the full path to the Application Data directory of the logged-in user
#~     LOCALAPPDATA = This variable is the temporary files of Applications.
#~      CURRENT = Folder where the game is run from

#~     !!!The following might require your game to run in admin mode!!!

#~     ProgramFiles = This variable points to Program Files directory
#~     CommonProgramFiles = This variable points to Common Files directory
    
  #Enter each subfolder paths after the primary folder here
  #The script automatically creates the folder path specified
  data_system = load_data("Data/System.rvdata2")
  FOLDER = ["RPGMaker",data_system.game_title.to_s]
    
  #File name of the custom data file, include file extension
  FILENAME = "Data.rvdata2"
    #Does the system save the custom data every time that you change it
    AUTOSAVE = true
  #On this example settings given, the file will be saved into
  #C:\Users\USER\AppData\Roaming\RPGMaker\Games\Data.rvdata2
  end
end

#==============================================================================
# DO NOT EDIT BELOW THIS LINE
#==============================================================================

module DataManager
 
  class <<self; alias load_database_customdata load_database; end
  def self.load_database
    load_database_customdata
    if not ADIK::DATA::DATA_PATH == 'CURRENT'
      @spath = ENV[ADIK::DATA::DATA_PATH] + "\\"
    else
      @spath = ""
    end
    ADIK::DATA::FOLDER.each do |path|
      @spath += path + "\\"
      Dir.mkdir(@spath) if !FileTest.exist?(@spath)
    end
    @path = @spath + ADIK::DATA::FILENAME
    begin
      load_customdata
    rescue
      $adik_custom_data = {}
      save_customdata
    end
  end
 
  class <<self; alias load_game_customdata load_game; end
  def self.load_game(index)
    if load_game_customdata(index)
      load_customdata unless ADIK::DATA::AUTOSAVE
      return true
    else
      return false
    end
  end
 
  def self.customdata_filename
    return  @path
  end
 
  def self.customdata_file_exists?
    FileTest.exist?(customdata_filename)
  end
 
  class <<self; alias save_game_without_rescue_customdata save_game_without_rescue; end
  def self.save_game_without_rescue(index)
    save_game_without_rescue_customdata(index)
    DataManager.save_customdata
    return true
  end
 
  def self.load_customdata
    File.open(customdata_filename, "rb") do |file|
      contents = Marshal.load(file)
      $adik_custom_data = contents[:adik_custom_data]
      $game_plus        = contents[:game_plus]
    end
    return true
  end
 
  def self.save_customdata
    File.open(customdata_filename, "wb") do |file|
      contents = {}
      contents[:adik_custom_data] = $adik_custom_data
      contents[:game_plus] = $game_plus
      Marshal.dump(contents, file)
    end
    return true
  end
 
end

module CustomData

  def self.get(key)
    return $adik_custom_data[key]
  end
 
  def self.set(key,value)
    $adik_custom_data[key] = value
    DataManager.save_customdata if ADIK::DATA::AUTOSAVE
  end
 
  def self.save
      DataManager.save_customdata
  end
 
  def self.add(key,value)
    $adik_custom_data[key] += value
    DataManager.save_customdata if ADIK::DATA::AUTOSAVE
  end
 
  def self.sub(key,value)
    $adik_custom_data[key] -= value
    DataManager.save_customdata if ADIK::DATA::AUTOSAVE
  end
 
  def self.mul(key,value)
    $adik_custom_data[key] *= value
    DataManager.save_customdata if ADIK::DATA::AUTOSAVE
  end
 
  def self.div(key,value)
    $adik_custom_data[key] /= value
    DataManager.save_customdata if ADIK::DATA::AUTOSAVE
  end
 
  def self.push(key,value)
      $adik_custom_data[key] = [] if $adik_custom_data[key].nil?
    $adik_custom_data[key].push(value)
    DataManager.save_customdata if ADIK::DATA::AUTOSAVE
  end
 
  def self.delete(key,value)
    $adik_custom_data[key].delete(value)
    DataManager.save_customdata if ADIK::DATA::AUTOSAVE
  end
 
end

class Scene_Title
  alias custom_data_start start
  def start
   custom_data_start
   DataManager.load_customdata unless ADIK::DATA::AUTOSAVE
 end
end

Bonus room script line 18 change it to this
$game_plus = Game_NewGamePlus.new unless $game_plus
You probably need to use a global save data script.
And make sure $game_plus is a part of it.

I did this with Adittuzkimo's custom data script.
Also a small change to the bonus room script

Spoiler: Adiktuzmiko Custom Data
Ruby:
=begin
 Game Custom Data v1.26
 by AdiktuzMiko
 --- Date Created: 11/25/2013
 --- Last Date Updated: 07/18/2015
 --- Level: Easy
 
 This is a simple script which provides you with the capability of having custom data
 for your game that is saved outside of the save files. Since it is outside of save
 files, it is shared by all. You can even make multiple games share a single custom
 data file.
 
 You can utilize this for having persistent data between your game/games.
 
 You can specify where to put the custom data file, what name will it have and even
 what file extension.
 
==============================================================================
   ++ Installation ++
==============================================================================
 Install this script in the Materials section in your project's
 script editor.
 
 Modify the ADIK::DATA module to your liking
 
==============================================================================
   ++ Script Calls ++
==============================================================================
 
 CustomData.get(key) to get a certain value
 CustomData.set(key,value) to set the value saved in "key" equal to "value"
 CustomData.add(key,value) to add value to the current value of the data
 CustomData.sub(key,value) to subtract value to the current value of the data
 CustomData.mul(key,value) to multiply the current value of the data by the given value
 CustomData.div(key,value) to divide the current value of the data by the given value
 CustomData.push(key,value) to add the given value into an array saved as custom data
 CustomData.delete(key,value) to remove the given value from an array saved as custom data
 CustomData.save to save the current contents of custom data
 
 Note: Custom Data is loaded automatically upon running the game
 
==============================================================================
   ++ Compatibility ++
==============================================================================
 This script aliases the following default VXA methods:

   DataManager#load_database
     DataManager#load_game
     Scene_Title#start
     DataManager#save_game_without_rescue
==============================================================================
   ++ Terms and Conditions ++
==============================================================================

 Read this: http://lescripts.wordpress.com/terms-and-conditions/

==============================================================================

 
=end

module ADIK
  module DATA
 
  # Primary folder where the save data will be placed
  # based on the default paths in your computer
  # set to nil if you don't want to use this
  DATA_PATH = 'AppData'
   
#~     Heres a list of parameters you can set the DATA_PATH into
#~    
#~     AppData = Contains the full path to the Application Data directory of the logged-in user
#~     LOCALAPPDATA = This variable is the temporary files of Applications.
#~      CURRENT = Folder where the game is run from

#~     !!!The following might require your game to run in admin mode!!!

#~     ProgramFiles = This variable points to Program Files directory
#~     CommonProgramFiles = This variable points to Common Files directory
   
  #Enter each subfolder paths after the primary folder here
  #The script automatically creates the folder path specified
  data_system = load_data("Data/System.rvdata2")
  FOLDER = ["RPGMaker",data_system.game_title.to_s]
   
  #File name of the custom data file, include file extension
  FILENAME = "Data.rvdata2"
    #Does the system save the custom data every time that you change it
    AUTOSAVE = true
  #On this example settings given, the file will be saved into
  #C:\Users\USER\AppData\Roaming\RPGMaker\Games\Data.rvdata2
  end
end

#==============================================================================
# DO NOT EDIT BELOW THIS LINE
#==============================================================================

module DataManager
 
  class <<self; alias load_database_customdata load_database; end
  def self.load_database
    load_database_customdata
    if not ADIK::DATA::DATA_PATH == 'CURRENT'
      @spath = ENV[ADIK::DATA::DATA_PATH] + "\\"
    else
      @spath = ""
    end
    ADIK::DATA::FOLDER.each do |path|
      @spath += path + "\\"
      Dir.mkdir(@spath) if !FileTest.exist?(@spath)
    end
    @path = @spath + ADIK::DATA::FILENAME
    begin
      load_customdata
    rescue
      $adik_custom_data = {}
      save_customdata
    end
  end
 
  class <<self; alias load_game_customdata load_game; end
  def self.load_game(index)
    if load_game_customdata(index)
      load_customdata unless ADIK::DATA::AUTOSAVE
      return true
    else
      return false
    end
  end
 
  def self.customdata_filename
    return  @path
  end
 
  def self.customdata_file_exists?
    FileTest.exist?(customdata_filename)
  end
 
  class <<self; alias save_game_without_rescue_customdata save_game_without_rescue; end
  def self.save_game_without_rescue(index)
    save_game_without_rescue_customdata(index)
    DataManager.save_customdata
    return true
  end
 
  def self.load_customdata
    File.open(customdata_filename, "rb") do |file|
      contents = Marshal.load(file)
      $adik_custom_data = contents[:adik_custom_data]
      $game_plus        = contents[:game_plus]
    end
    return true
  end
 
  def self.save_customdata
    File.open(customdata_filename, "wb") do |file|
      contents = {}
      contents[:adik_custom_data] = $adik_custom_data
      contents[:game_plus] = $game_plus
      Marshal.dump(contents, file)
    end
    return true
  end
 
end

module CustomData

  def self.get(key)
    return $adik_custom_data[key]
  end
 
  def self.set(key,value)
    $adik_custom_data[key] = value
    DataManager.save_customdata if ADIK::DATA::AUTOSAVE
  end
 
  def self.save
      DataManager.save_customdata
  end
 
  def self.add(key,value)
    $adik_custom_data[key] += value
    DataManager.save_customdata if ADIK::DATA::AUTOSAVE
  end
 
  def self.sub(key,value)
    $adik_custom_data[key] -= value
    DataManager.save_customdata if ADIK::DATA::AUTOSAVE
  end
 
  def self.mul(key,value)
    $adik_custom_data[key] *= value
    DataManager.save_customdata if ADIK::DATA::AUTOSAVE
  end
 
  def self.div(key,value)
    $adik_custom_data[key] /= value
    DataManager.save_customdata if ADIK::DATA::AUTOSAVE
  end
 
  def self.push(key,value)
      $adik_custom_data[key] = [] if $adik_custom_data[key].nil?
    $adik_custom_data[key].push(value)
    DataManager.save_customdata if ADIK::DATA::AUTOSAVE
  end
 
  def self.delete(key,value)
    $adik_custom_data[key].delete(value)
    DataManager.save_customdata if ADIK::DATA::AUTOSAVE
  end
 
end

class Scene_Title
  alias custom_data_start start
  def start
   custom_data_start
   DataManager.load_customdata unless ADIK::DATA::AUTOSAVE
 end
end

Bonus room script line 18 change it to this
$game_plus = Game_NewGamePlus.new unless $game_plus
It works now thanks!

Original thread: https://forums.rpgmakerweb.com/threads/little-bonus-room-script-error-solved.170005/