Skitzen

File missing crash fix [RMXP]

Jun 26th, 2015 (edited)
1,678
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.26 KB | None | 0 0
  1. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  2. # **Graphic/Audio file missing crash Fix
  3. # **By ApproximatelyCats
  4. # ** Version 1.0
  5. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  6. =begin
  7.  
  8. **Plug n play, no need for any customization unless wanted.**
  9.  
  10. This script gets rid of the crash that happens when a file is missing during
  11. game play. The game will announce exactly what is missing from what folder and
  12. then continue on with the game.
  13.  
  14. This is especially perfect for beta testing, but can also be used in the full
  15. release of a game.
  16.  
  17. ** Compatibility issues:
  18. None so far that I can find, works with scripts that require calling filess
  19. from folders not in the main folders.
  20. Please let me know if you find any.
  21.  
  22. Known bugs:
  23. Does not display name of missing audio file, or custom audio folders if any.
  24. (looking into it still.)
  25.  
  26.  
  27. **Credit
  28. Feel free to use this in any commercial/non-commercial work. I just ask that you
  29. at least give credit to me for the work.
  30.  
  31. =end
  32. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  33.  
  34. #Start
  35.  
  36. class << Bitmap
  37.     alias_method :error_new, :new unless method_defined?(:error_new)
  38.      def new(*args)
  39.      error_new(*args)
  40.     rescue
  41.      if args.size == 1
  42.     print ("Missing resource file: "), args[0]
  43.   end
  44.     begin
  45.     error_new
  46.     rescue
  47.     error_new(32, 32)
  48.     end
  49.   end
  50. end
  51.  
  52.     module Audio
  53.      class << self
  54.      alias_method :error_play_bgm, :bgm_play
  55.      alias_method :error_play_bgs, :bgs_play
  56.      alias_method :error_play_se, :se_play
  57.      alias_method :error_play_me, :me_play
  58. end
  59.    
  60.     def self.bgm_play(filename, volume = 100, pitch = 100)
  61.     self.error_play_bgm(filename, volume, pitch)
  62.     rescue
  63.     print ("Missing resource file: Audio/BGM/    ")
  64. end
  65.  
  66.     def self.bgs_play(filename, volume = 100, pitch = 100)
  67.     self.error_play_bgs(filename, volume, pitch)
  68.     rescue
  69.     print ("Missing resource file: Audio/BGS/    ")
  70. end
  71.  
  72.     def self.se_play(filename, volume = 100, pitch = 100)
  73.     self.error_play_se(filename, volume, pitch)
  74.     rescue
  75.     print ("Missing resource file: Audio/SE/    ")
  76. end
  77.  
  78.     def self.me_play(filename, volume = 100, pitch = 100)
  79.     self.error_play_me(filename, volume, pitch)
  80.     rescue
  81.     print ("Missing resource file: Audio/ME/    ")
  82. end
  83. end
Add Comment
Please, Sign In to add comment