Save-Point
Load file error dialog - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+---- Forum: RPGMaker XP (RGSS) Engine (https://www.save-point.org/forum-116.html)
+---- Thread: Load file error dialog (/thread-2474.html)



Load file error dialog - Zeriab - 03-06-2008

If a save file has become corrupted or something else causes the load process to fail you can use this script to display the error and allow the player to select another save.
You need my Dialog System. (Only the system, not the yes/no dialog present in that topic)
You also need this ok dialog
Dialog_Ok

Then its just to insert this script somewhere above main and below Dialog_Ok

Code:
# Error message on corrupt files
# by Zeriab
# Requires Dialog System and Dialog_Ok

#==============================================================================
# ** Scene_Load
#------------------------------------------------------------------------------
#  This class performs load screen processing.
#==============================================================================

class Scene_Load < Scene_File
  #--------------------------------------------------------------------------
  # * Decision Processing
  #--------------------------------------------------------------------------
  unless self.method_defined?(:zeriab_load_on_decision)
    alias zeriab_load_on_decision on_decision
  end
  def on_decision(filename)
    begin
      # The original call
      zeriab_load_on_decision(filename)
    rescue Exception => error
      # Play buzzer SE
      $game_system.se_play($data_system.buzzer_se)
      # Show error message
      Dialog_Ok.show(error.message)
    end
  end
end
Note that this will not prevent errors from crashing the game if Window_SaveFile fails to read the little portion of the save file it needs.

*hugs*
- Zeriab