[Script] [RPGXP] [System] 'File missing error' preventer
[chapter]Giới Thiệu[/chapter]
Bình thường khi game thiếu tài nguyên, dù chỉ 1 file SE hay icon nhỏ xíu thì nó cũng báo error và văng ra, khiến người chơi cảm thấy nản khi chơi game của bạn, script này sẽ giúp game vẫn tiếp tục dù có thiếu file hay không.
[chapter]Script:[/chapter]
[php]#===============================================================
# ● [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
# Thông báo thiếu file khi lỗi xuất hiện
Record_Missing_File = true
# Ghi tên file thiếu vào 1 file text
Missing_Log_File_Name = 'missing_log.txt'
# Tên file text
Use_Audio_Replacement = false
# Thay thế tập tin âm thanh bị mất bằng tập tin khác
Audio_Replacement_File = 'Audio/SE/015-Jump01'
# Tên tập tin âm thanh
Use_Bitmap_Replacement = false
# Thay thế file ảnh bị mất bằng file khác
Bitmap_Replacement_File = 'Graphics/Fogs/001-Fog01'
# Tên file ảnh thay thế
#
# * [END] 'FILE MISSING ERROR' PREVENTER SETUP PART *
#========================================================
def self.print(type, name)
if Print_Missing_File
p 'Missed File: ' + name.to_s
end
if Record_Missing_File
file = File.open(Missing_Log_File_Name, "a+")
type = type == 0 ? 'Bitmap' : 'Audio'
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
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
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[/php]
[chapter]Hướng Dẫn:[/chapter]
Đặt script này trên toàn bộ script, kể cả mặc định.
Chỉnh lại script này theo ý bạn, đã hướng dẫn trong script
[chapter]Điều Khoản[/chapter]
Ko dùng với dự án thương mại
[chapter]Tác Giả Bài Viết Củ[/chapter]
Dang_Khoa
[chapter]Tác Giả Script[/chapter]
woratana
[chapter]Nguồn[/chapter]
rpgmakervx.net
Bình thường khi game thiếu tài nguyên, dù chỉ 1 file SE hay icon nhỏ xíu thì nó cũng báo error và văng ra, khiến người chơi cảm thấy nản khi chơi game của bạn, script này sẽ giúp game vẫn tiếp tục dù có thiếu file hay không.
[chapter]Script:[/chapter]
[php]#===============================================================
# ● [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
# Thông báo thiếu file khi lỗi xuất hiện
Record_Missing_File = true
# Ghi tên file thiếu vào 1 file text
Missing_Log_File_Name = 'missing_log.txt'
# Tên file text
Use_Audio_Replacement = false
# Thay thế tập tin âm thanh bị mất bằng tập tin khác
Audio_Replacement_File = 'Audio/SE/015-Jump01'
# Tên tập tin âm thanh
Use_Bitmap_Replacement = false
# Thay thế file ảnh bị mất bằng file khác
Bitmap_Replacement_File = 'Graphics/Fogs/001-Fog01'
# Tên file ảnh thay thế
#
# * [END] 'FILE MISSING ERROR' PREVENTER SETUP PART *
#========================================================
def self.print(type, name)
if Print_Missing_File
p 'Missed File: ' + name.to_s
end
if Record_Missing_File
file = File.open(Missing_Log_File_Name, "a+")
type = type == 0 ? 'Bitmap' : 'Audio'
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
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
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[/php]
[chapter]Hướng Dẫn:[/chapter]
Đặt script này trên toàn bộ script, kể cả mặc định.
Chỉnh lại script này theo ý bạn, đã hướng dẫn trong script
[chapter]Điều Khoản[/chapter]
Ko dùng với dự án thương mại
[chapter]Tác Giả Bài Viết Củ[/chapter]
Dang_Khoa
[chapter]Tác Giả Script[/chapter]
woratana
[chapter]Nguồn[/chapter]
rpgmakervx.net
Comments
Post trước những script cần thiết..script mới tính sao !
thiên vị xp quá
cái này dùng được với vxa nhưng lại không hiện thông báo