Project1

标题: 可不可以设置找不到音乐文件也可以运行的方法? [打印本页]

作者: bafsdaas    时间: 2011-9-10 11:02
提示: 作者被禁止或删除 内容自动屏蔽
作者: pkboy9999    时间: 2011-9-10 12:26
把F9的数据库里面所有音效改成无
作者: bafsdaas    时间: 2011-9-10 12:47
提示: 作者被禁止或删除 内容自动屏蔽
作者: fux2    时间: 2011-9-10 13:05
main整个用loop套起来,然后rescue不处理。
作者: 亿万星辰    时间: 2011-9-10 14:33
容错脚本
作者: zhengxinwu    时间: 2011-9-10 17:49
找不到 就随便安一个取名叫GAME OVER的音乐
不就行了
作者: 昔日辉煌灬    时间: 2011-9-12 19:05
脚本:.......
  1. #===============================================================
  2. # ● [XP/VX] ◦ 'FILE MISSING ERROR' PREVENTER ◦ □
  3. # * Game won't quit because file missing error anymore~ *
  4. #--------------------------------------------------------------
  5. # ◦ by Woratana [[email protected]]
  6. # ◦ Thaiware RPG Maker Community
  7. # ◦ Released on: 05/10/2008
  8. # ◦ Version: 1.0
  9. #--------------------------------------------------------------
  10. # * Put this script over everything in your game!
  11. # (Default scripts in Script Editor are not an exception!)
  12. #------------------------------------------------------------------

  13. module Wora_FMEP
  14.   #========================================================
  15.   # * [START] 'FILE MISSING ERROR' PREVENTER SETUP PART *
  16.   #--------------------------------------------------------
  17.   Print_Missing_File = true
  18.   # Print Missing File when error occured
  19.   
  20.   Record_Missing_File = true
  21.   # Record missing file to missing file log?
  22.   Missing_Log_File_Name = 'missing_log.txt'
  23.   # Name of file to store missing file names list
  24.   
  25.   Use_Audio_Replacement = false
  26.   # Use replacement audio file for missing audio?
  27.   Audio_Replacement_File = 'Audio/SE/Buzzer1'
  28.   # Audio file that will play for miassing audio
  29.   
  30.   Use_Bitmap_Replacement = false
  31.   # Use replacement image file for missing image?
  32.   Bitmap_Replacement_File = 'Graphics/Pictures/Filler'
  33.   # Image file that will use for missing image
  34.   #--------------------------------------------------------
  35.   # * [END] 'FILE MISSING ERROR' PREVENTER SETUP PART *
  36.   #========================================================
  37.   
  38.   def self.print(type, name)
  39.     if Print_Missing_File
  40.       p 'Missed File: ' + name.to_s
  41.     end
  42.     if Record_Missing_File
  43.       file = File.open(Missing_Log_File_Name, "a+")
  44.       type = type == 0 ? 'Bitmap' : 'Audio'
  45.       text = '*' + type.to_s + '* :' + name.to_s + "\n"
  46.       file.write(text) unless file.readlines.include?(text)
  47.       file.close
  48.     end
  49.   end
  50. end

  51. class << Audio
  52.   AUDME = [:bgm_play, :bgs_play, :me_play, :se_play]
  53.   AUDME.each do |method|
  54.     new_method = 'wora_fmep_aud_' + method.to_s
  55.     alias_method(new_method, method) unless $@
  56. new_def = <<_ALIAS_
  57. def #{method}(*args)
  58.   begin
  59.     #{new_method}(*args)
  60.   rescue
  61.     Wora_FMEP.print(1, args[0])
  62.     #{new_method}(Wora_FMEP::Audio_Replacement_File, args[1], args[2]) if
  63.   Wora_FMEP::Use_Audio_Replacement
  64.   end
  65. end
  66. _ALIAS_
  67. eval(new_def)
  68.   end
  69. end

  70. class Bitmap
  71.   unless $@
  72.     alias wora_fmep_bmp_ini initialize
  73.     def initialize(*args)
  74.       begin
  75.         wora_fmep_bmp_ini(*args)
  76.       rescue
  77.         Wora_FMEP.print(0, args[0])
  78.         if Wora_FMEP::Use_Bitmap_Replacement
  79.           wora_fmep_bmp_ini(Wora_FMEP::Bitmap_Replacement_File)
  80.         else
  81.           wora_fmep_bmp_ini(32, 32)
  82.         end
  83.       end
  84.     end
  85.   end
  86. end
复制代码





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1