#===============================================================
# ● [XP/VX] ◦ 'FILE MISSING ERROR' PREVENTER ◦ □
# * Game won't quit because file missing error anymore~ *
#
# ◦ by Woratana [
woratana@hotmail.com]
# ◦ Thaiware RPG Maker Community
# ◦ Released on: 05/10/2008
# ◦ Version: 1.0
#
# * Put this script over everything in your game!
# (Default scripts in Script Editor are not an exception!)
#
module Wora_FMEP
#========================================================
# * [START] 'FILE MISSING ERROR' PREVENTER SETUP PART *
#
Print_Missing_File = true
# Print Missing File when error occured
Record_Missing_File = true
# Record missing file to missing file log?
Missing_Log_File_Name = 'Список отсутсвующих файлов.txt'
# Name of file to store missing file names list
Use_Audio_Replacement = false
# Use replacement audio file for missing audio?
Audio_Replacement_File = 'Audio/SE/015-Jump01'
# Audio file that will play for missing audio
Use_Bitmap_Replacement = false
# Use replacement image file for missing image?
Bitmap_Replacement_File = 'Graphics/Fogs/001-Fog01'
# Image file that will use for missing image
#
# * [END] 'FILE MISSING ERROR' PREVENTER SETUP PART *
#========================================================
def self.print(type, name)
if Print_Missing_File
p 'Отсутсвующие файлы: ' + name.to_s
end
if Record_Missing_File
file = File.open(Missing_Log_File_Name, "a+")
type = type == 0 ? 'Картинка' : 'Звук'
text = '*' + type.to_s + '* :' + name.to_s + "\n"
file.write(text) unless file.readlines.include?(text)
file.close
end
end
end
class << Audio
AUDME = [:bgm_play, :bgs_play, :me_play, :se_play]
AUDME.each do |method|
new_method = 'wora_fmep_aud_' + method.to_s
alias_method(new_method, method) unless $@
new_def = <<_ALIAS_
def #{method}(*args)
begin
#{new_method}(*args)
rescue
Wora_FMEP.print(1, args[0])
#{new_method}(Wora_FMEP::Audio_Replacement_File, args[1], args[2]) if
Wora_FMEP::Use_Audio_Replacement
end
end
_ALIAS_
eval(new_def)
end
end
class Bitmap
unless $@
alias wora_fmep_bmp_ini initialize
def initialize(*args)
begin
wora_fmep_bmp_ini(*args)
rescue
Wora_FMEP.print(0, args[0])
if Wora_FMEP::Use_Bitmap_Replacement
wora_fmep_bmp_ini(Wora_FMEP::Bitmap_Replacement_File)
else
wora_fmep_bmp_ini(32, 32)
end
end
end
end
end